modalist 1.0.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53028ebc1dacdef9d576a4e9f21061bd00172a9070b4c161554da6f5cddc06fa
4
- data.tar.gz: e1dd7149960ad31054211201458406c48d7f17e35a9a848c572fff4828f04e24
3
+ metadata.gz: cc9791cd9988e334e98cd849c3eeff2fb56117db6bbdb2773b763b744aae09f7
4
+ data.tar.gz: 4c6d521c95218d503b337e9b1aaa0de6419954f962dfb60df1a9ef01b9b50e5c
5
5
  SHA512:
6
- metadata.gz: 5d7315cbca574bbb81d2b007516a1202ea3ea2bdb874008750d7a458edbe9a64237f363044e867ac382d7690f2ae265d0cba56514b29a45b6cf30432c802cbd0
7
- data.tar.gz: 5b96ae247bad1b60dfd4642433e2fd75ef579add4d45946ad04d47a9829c451c7946a90454ba2ed1dbf6d3489a674457d4cdf3dacdf8e918b710ea027c626d0b
6
+ metadata.gz: 9c57d52e6af4fe4554d2382252ddd04c6720b107211c82a160b833cc5ee008223094f565a489eb4fef566cbd2bbe1ba77245dc072d18a1c5893f2dd142ad3d29
7
+ data.tar.gz: 1d5c9c45a18cae4a20cf7ba26b55f881789c5cd2692c2badd88a95755bc978a79f16ac634ed252b9860cfd9d717788bd2560b6f7f39df1ac46d25c87ceb8de18
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 2.0.p - 2018/02/09
8
+
9
+ * features
10
+ * updated Modalist.js to 2.0.0
11
+
7
12
  ### 1.0.3 - 2018/01/07
8
13
 
9
14
  * bugfixes
data/README.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/modalist.svg)](https://badge.fury.io/rb/modalist) <img src="https://travis-ci.org/jonhue/modalist.svg?branch=master" />
4
4
 
5
- Modalist is a powerful ajaxified modal solution for Rails. Here is how it works:
5
+ Modalist is a powerful & lightweight (not necessarily but primarily ajaxified) modal plugin. Here is how it works:
6
6
 
7
- 1) You trigger a modal opening from your frontend code
8
- 2) Modalist fetches the modal contents from your specific modal-controller-action with AJAX
9
- 3) The modal opens
7
+ 1) You create a distinct Modalist object for every modal style.
8
+ 2) You trigger a modal from your frontend code passing custom parameters
9
+ 3) Modalist fetches the modal contents with AJAX while showing a loader (skippable if not desired)
10
+ 4) The modal opens
10
11
 
11
- Modalist does not reinvent the wheel and uses todays best modal-engine [iziModal.js](https://github.com/dolce/iziModal) to backup its code.
12
+ Learn more about **[Modalist.js](https://github.com/jonhue/modalist.js)**.
12
13
 
13
14
  ---
14
15
 
@@ -23,6 +24,7 @@ Modalist does not reinvent the wheel and uses todays best modal-engine [iziModal
23
24
  * [To Do](#to-do)
24
25
  * [Contributing](#contributing)
25
26
  * [Contributors](#contributors)
27
+ * [Semantic versioning](#semantic-versioning)
26
28
  * [License](#license)
27
29
 
28
30
  ---
@@ -51,23 +53,20 @@ gem 'modalist', github: 'jonhue/modalist'
51
53
 
52
54
  ## Usage
53
55
 
54
- First let's add the necessary assets to your pipeline:
56
+ First let's import the necessary assets:
55
57
 
56
- ```js
57
- //= require jquery
58
- //= require iziModal
59
- //= require modalist
58
+ ```javascript
59
+ import Modalist from 'modalist';
60
+ Modalist.init();
61
+ let modalist = new Modalist;
60
62
  ```
61
63
 
62
- ```css
63
- /*
64
- *= require iziModal
65
- *= require modalist.min
66
- */
64
+ ```sass
65
+ @import "animate.css"
66
+ @import "modalist/src/modalist"
67
+ @import "modalist/src/modalist-theme"
67
68
  ```
68
69
 
69
- **Note:** If you are using a package manager like Yarn, import the latest [iziModal](https://github.com/dolce/iziModal) and [modalist](https://github.com/jonhue/modalist.js) code instead.
70
-
71
70
  Specify where modals should be located in your view:
72
71
 
73
72
  ```haml
@@ -76,13 +75,13 @@ Specify where modals should be located in your view:
76
75
  %head
77
76
  -# ...
78
77
  %body
79
- = render_modalist
78
+ = component 'modalist'
80
79
  = yield
81
80
  ```
82
81
 
83
82
  ### Controllers
84
83
 
85
- Modallist simulates Rails' MVC structure. To add a new modal to your app you have to create a new controller action, route and view:
84
+ Modallist simulates Rails' MVC structure. To add a new modal to your app, you have to create a new controller action, route and view:
86
85
 
87
86
  ```ruby
88
87
  class SettingsController < ApplicationController
@@ -91,7 +90,7 @@ class SettingsController < ApplicationController
91
90
  # a regular controller action
92
91
  end
93
92
 
94
- def modalist
93
+ def modal
95
94
  modalist
96
95
  # a modalist controller action
97
96
  end
@@ -104,7 +103,7 @@ Rails.application.routes.draw do
104
103
 
105
104
  get 'settings', to: 'settings#index'
106
105
  scope :settings, as: :settings do
107
- get 'modalist', to: 'settings#modalist'
106
+ get 'modal', to: 'settings#modal'
108
107
  end
109
108
 
110
109
  end
@@ -113,7 +112,7 @@ end
113
112
  In most cases you only want to allow AJAX requests to be able to reach your modal-controller-actions:
114
113
 
115
114
  ```ruby
116
- get 'modalist', to: 'settings#modalist', constraints: Modalist::Ajax.new
115
+ get 'modal', to: 'settings#modal', constraints: Modalist::Ajax.new
117
116
  ```
118
117
 
119
118
  ### Views
@@ -126,7 +125,7 @@ In your Modalist views are a couple of helper methods available:
126
125
 
127
126
  **`modalist_actions(&block)`:** Specify actions (preferably icons wrapped in links) which will be displayed on the right side of your modal header. Takes a block.
128
127
 
129
- **`modalist_close`:** Renders a default modal close action. Can be passed to `modalist_actions`.
128
+ **`modalist_closer`:** Renders a default modal close action. Can be passed to `modalist_actions`.
130
129
 
131
130
  #### Example
132
131
 
@@ -134,31 +133,29 @@ In your Modalist views are a couple of helper methods available:
134
133
  - modalist_title 'Modal'
135
134
  - modalist_subtitle 'Subtitle'
136
135
  - modalist_actions do
137
- = modalist_close
136
+ = component 'modalist/closer'
138
137
 
139
138
  Content ...
140
139
  ```
141
140
 
142
141
  ### Styles
143
142
 
144
- To customize the styles of your modals, require the vendored default styles and then override them with your custom CSS.
145
-
146
- It is often useful to be able to provide view-specific styles. Modalist therefore adds classes for controller and action to the `.modalist--content` element which wraps your modals content. Here is how you can utilize it:
143
+ It is often useful to be able to provide view-specific styles. Modalist therefore adds classes for controller and action to the `.modalist--content-body` element which wraps your modals content. Here is how you can utilize it:
147
144
 
148
145
  ```css
149
- /* settings#modalist */
150
- .modalist--content.settings.modalist {
146
+ /* settings#modal */
147
+ .modalist--content-body.settings.modal {
151
148
  /* ... */
152
149
  }
153
- /* nested/settings#modalist */
154
- .modalist--content.nested.settings.modalist {
150
+ /* nested/settings#modal */
151
+ .modalist--content-body.nested.settings.modal {
155
152
  /* ... */
156
153
  }
157
154
  ```
158
155
 
159
156
  ### Modalist.js
160
157
 
161
- Continue reading [here](https://github.com/jonhue/modalist.js) to learn how to use modalist.js to open modals and fetch their content vie AJAX.
158
+ Continue reading [here](https://github.com/jonhue/modalist.js) to learn how to use Modalist.js to open modals and fetch content via AJAX.
162
159
 
163
160
  ---
164
161
 
@@ -182,6 +179,10 @@ Give the people some :heart: who are working on this project. See them all at:
182
179
 
183
180
  https://github.com/jonhue/modalist/graphs/contributors
184
181
 
182
+ ### Semantic Versioning
183
+
184
+ Modalist follows Semantic Versioning 2.0 as defined at http://semver.org.
185
+
185
186
  ## License
186
187
 
187
188
  MIT License
@@ -1,14 +1,6 @@
1
1
  module Modalist
2
2
  module ModalHelper
3
3
 
4
- def render_modalist
5
- render partial: 'modalist/modal'
6
- end
7
-
8
- def modalist_close
9
- render partial: 'modalist/close'
10
- end
11
-
12
4
  def modalist_title title
13
5
  area :modalist_title, title
14
6
  end
@@ -1,5 +1,5 @@
1
1
  <% if area(:modalist_title).length > 0 %>
2
- <div class="modalist--header">
2
+ <div class="modalist--content-header">
3
3
  <div class="wrapper">
4
4
  <h4><%= area :modalist_title %></h4>
5
5
  <% if area(:modalist_subtitle).length > 0 %>
@@ -14,6 +14,6 @@
14
14
  </div>
15
15
  <% end %>
16
16
 
17
- <div class="modalist--content <%= modalist_class_hierarchy [params[:controller].split('/').each { |n| n }, action_name] %>">
17
+ <div class="modalist--content-body <%= modalist_class_hierarchy [params[:controller].split('/').each { |n| n }, action_name] %>">
18
18
  <%= yield %>
19
19
  </div>
@@ -0,0 +1,13 @@
1
+ <div id="modalist--overlay">
2
+ <div class="modalist--loader">
3
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"><g transform="translate(0, 0)"><g class="nc-loop_bars-rotate-24" transform="rotate(270 12 12)"> <rect x="11" fill="#444444" width="2" height="6"></rect> <rect x="17.3639603" y="2.636039" transform="matrix(0.7071068 0.7071068 -0.7071068 0.7071068 9.3639612 -11.3345242)" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="18" y="11" fill="#444444" width="6" height="2" style="opacity: 0.4;"></rect> <rect x="17.3639603" y="15.3639612" transform="matrix(-0.7071068 0.7071068 -0.7071068 -0.7071068 44.3345222 18.3639603)" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="11" y="18" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="4.6360388" y="15.3639612" transform="matrix(-0.7071068 -0.7071068 0.7071068 -0.7071068 -3.363961 35.3345222)" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="0" y="11" fill="#444444" width="6" height="2" style="opacity: 0.5;"></rect> <rect x="4.6360388" y="2.636039" transform="matrix(0.7071068 -0.7071068 0.7071068 0.7071068 -2.3345237 5.6360388)" fill="#444444" width="2" height="6" style="opacity: 0.8;"></rect> </g> <script>!function(){function t(t){this.element=t,this.animationId,this.start=null,this.init()}if(!window.requestAnimationFrame){var i=null;window.requestAnimationFrame=function(t,n){var e=(new Date).getTime();i||(i=e);var a=Math.max(0,16-(e-i)),o=window.setTimeout(function(){t(e+a)},a);return i=e+a,o}}t.prototype.init=function(){var t=this;this.animationId=window.requestAnimationFrame(t.triggerAnimation.bind(t))},t.prototype.reset=function(){var t=this;window.cancelAnimationFrame(t.animationId)},t.prototype.triggerAnimation=function(t){var i=this;this.start||(this.start=t);var n=t-this.start;800&gt;n||(this.start=this.start+800),this.element.setAttribute("transform","rotate("+parseInt(Math.min(n/100,8))%8*45+" 12 12)");if(document.documentElement.contains(this.element))window.requestAnimationFrame(i.triggerAnimation.bind(i))};var n=document.getElementsByClassName("nc-loop_bars-rotate-24"),e=[];if(n)for(var a=0;n.length&gt;a;a++)!function(i){e.push(new t(n[i]))}(a);document.addEventListener("visibilitychange",function(){"hidden"==document.visibilityState?e.forEach(function(t){t.reset()}):e.forEach(function(t){t.init()})})}();</script></g></svg>
4
+ </div>
5
+ </div>
6
+ <div class="modalist">
7
+ <div class="modalist--loader">
8
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"><g transform="translate(0, 0)"><g class="nc-loop_bars-rotate-24" transform="rotate(270 12 12)"> <rect x="11" fill="#444444" width="2" height="6"></rect> <rect x="17.3639603" y="2.636039" transform="matrix(0.7071068 0.7071068 -0.7071068 0.7071068 9.3639612 -11.3345242)" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="18" y="11" fill="#444444" width="6" height="2" style="opacity: 0.4;"></rect> <rect x="17.3639603" y="15.3639612" transform="matrix(-0.7071068 0.7071068 -0.7071068 -0.7071068 44.3345222 18.3639603)" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="11" y="18" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="4.6360388" y="15.3639612" transform="matrix(-0.7071068 -0.7071068 0.7071068 -0.7071068 -3.363961 35.3345222)" fill="#444444" width="2" height="6" style="opacity: 0.4;"></rect> <rect x="0" y="11" fill="#444444" width="6" height="2" style="opacity: 0.5;"></rect> <rect x="4.6360388" y="2.636039" transform="matrix(0.7071068 -0.7071068 0.7071068 0.7071068 -2.3345237 5.6360388)" fill="#444444" width="2" height="6" style="opacity: 0.8;"></rect> </g> <script>!function(){function t(t){this.element=t,this.animationId,this.start=null,this.init()}if(!window.requestAnimationFrame){var i=null;window.requestAnimationFrame=function(t,n){var e=(new Date).getTime();i||(i=e);var a=Math.max(0,16-(e-i)),o=window.setTimeout(function(){t(e+a)},a);return i=e+a,o}}t.prototype.init=function(){var t=this;this.animationId=window.requestAnimationFrame(t.triggerAnimation.bind(t))},t.prototype.reset=function(){var t=this;window.cancelAnimationFrame(t.animationId)},t.prototype.triggerAnimation=function(t){var i=this;this.start||(this.start=t);var n=t-this.start;800&gt;n||(this.start=this.start+800),this.element.setAttribute("transform","rotate("+parseInt(Math.min(n/100,8))%8*45+" 12 12)");if(document.documentElement.contains(this.element))window.requestAnimationFrame(i.triggerAnimation.bind(i))};var n=document.getElementsByClassName("nc-loop_bars-rotate-24"),e=[];if(n)for(var a=0;n.length&gt;a;a++)!function(i){e.push(new t(n[i]))}(a);document.addEventListener("visibilitychange",function(){"hidden"==document.visibilityState?e.forEach(function(t){t.reset()}):e.forEach(function(t){t.init()})})}();</script></g></svg>
9
+ </div>
10
+ <div class="modalist--content">
11
+ <%= block %>
12
+ </div>
13
+ </div>
@@ -0,0 +1,8 @@
1
+ <%= link_to 'javascript:void(0)', class: 'modalist--closer' do %>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24">
3
+ <g stroke-width="2" transform="translate(0, 0)">
4
+ <line fill="none" stroke="#657786" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" x1="16" y1="8" x2="8" y2="16" stroke-linejoin="miter"></line>
5
+ <line fill="none" stroke="#657786" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" x1="16" y1="16" x2="8" y2="8" stroke-linejoin="miter"></line>
6
+ </g>
7
+ </svg>
8
+ <% end %>
@@ -3,6 +3,13 @@ require 'rails/railtie'
3
3
  module Modalist
4
4
  class Railtie < Rails::Railtie
5
5
 
6
+ initializer 'modalist.mozaic' do
7
+ Mozaic.configure do |config|
8
+ config.define_component 'modalist'
9
+ config.define_component 'modalist/closer'
10
+ end
11
+ end
12
+
6
13
  initializer 'modalist.action_controller' do
7
14
  ActiveSupport.on_load :action_controller do
8
15
  include Modalist::RenderHelper
@@ -1,5 +1,5 @@
1
1
  module Modalist
2
2
 
3
- VERSION = '1.0.3'
3
+ VERSION = '2.0.0'
4
4
 
5
5
  end
data/lib/modalist.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'mozaic'
1
2
  require 'modalist/version'
2
3
 
3
4
  module Modalist
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modalist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-07 00:00:00.000000000 Z
11
+ date: 2018-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,19 +25,33 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: nestive-rails
28
+ name: actionpack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mozaic
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '1.0'
47
+ version: '2.0'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '1.0'
54
+ version: '2.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +80,8 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0.52'
69
- description: A powerful ajaxified modal solution for Rails apps.
83
+ description: Modalist is a powerful & lightweight (not necessarily but primarily ajaxified)
84
+ modal plugin.
70
85
  email:
71
86
  - me@jonhue.me
72
87
  executables: []
@@ -79,21 +94,13 @@ files:
79
94
  - app/helpers/modalist/modal_helper.rb
80
95
  - app/helpers/modalist/render_helper.rb
81
96
  - app/views/layouts/modalist.html.erb
82
- - app/views/modalist/_close.html.erb
83
- - app/views/modalist/_modal.html.erb
97
+ - app/views/mozaic/_modalist.html.erb
98
+ - app/views/mozaic/modalist/closer.html.erb
84
99
  - lib/modalist.rb
85
100
  - lib/modalist/ajax.rb
86
101
  - lib/modalist/engine.rb
87
102
  - lib/modalist/railtie.rb
88
103
  - lib/modalist/version.rb
89
- - vendor/assets/javascripts/iziModal.js
90
- - vendor/assets/javascripts/iziModal.min.js
91
- - vendor/assets/javascripts/modalist.js
92
- - vendor/assets/javascripts/modalist.min.js
93
- - vendor/assets/stylesheets/iziModal.css
94
- - vendor/assets/stylesheets/iziModal.min.css
95
- - vendor/assets/stylesheets/modailst.min.css
96
- - vendor/assets/stylesheets/modalist.sass
97
104
  homepage: https://github.com/jonhue/modalist
98
105
  licenses:
99
106
  - MIT
@@ -117,5 +124,5 @@ rubyforge_project:
117
124
  rubygems_version: 2.7.4
118
125
  signing_key:
119
126
  specification_version: 4
120
- summary: A powerful ajaxified modal solution for Rails apps
127
+ summary: A powerful & (really) lightweight AJAX modal plugin
121
128
  test_files: []
@@ -1,4 +0,0 @@
1
- <%= link_to 'javascript:void(0)', class: 'modalist--close', data: { izimodal_close: true } do %>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"><g stroke-width="2" transform="translate(0, 0)"><line fill="none" stroke="#657786" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" x1="16" y1="8" x2="8" y2="16" stroke-linejoin="miter"></line>
3
- <line fill="none" stroke="#657786" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" x1="16" y1="16" x2="8" y2="8" stroke-linejoin="miter"></line></g></svg>
4
- <% end %>
@@ -1,2 +0,0 @@
1
- <div id="modalist">
2
- </div>