modalist 1.0.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +33 -32
- data/app/helpers/modalist/modal_helper.rb +0 -8
- data/app/views/layouts/modalist.html.erb +2 -2
- data/app/views/mozaic/_modalist.html.erb +13 -0
- data/app/views/mozaic/modalist/closer.html.erb +8 -0
- data/lib/modalist/railtie.rb +7 -0
- data/lib/modalist/version.rb +1 -1
- data/lib/modalist.rb +1 -0
- metadata +25 -18
- data/app/views/modalist/_close.html.erb +0 -4
- data/app/views/modalist/_modal.html.erb +0 -2
- data/vendor/assets/javascripts/iziModal.js +0 -1440
- data/vendor/assets/javascripts/iziModal.min.js +0 -6
- data/vendor/assets/javascripts/modalist.js +0 -143
- data/vendor/assets/javascripts/modalist.min.js +0 -27
- data/vendor/assets/stylesheets/iziModal.css +0 -1097
- data/vendor/assets/stylesheets/iziModal.min.css +0 -6
- data/vendor/assets/stylesheets/modailst.min.css +0 -27
- data/vendor/assets/stylesheets/modalist.sass +0 -112
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc9791cd9988e334e98cd849c3eeff2fb56117db6bbdb2773b763b744aae09f7
|
4
|
+
data.tar.gz: 4c6d521c95218d503b337e9b1aaa0de6419954f962dfb60df1a9ef01b9b50e5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c57d52e6af4fe4554d2382252ddd04c6720b107211c82a160b833cc5ee008223094f565a489eb4fef566cbd2bbe1ba77245dc072d18a1c5893f2dd142ad3d29
|
7
|
+
data.tar.gz: 1d5c9c45a18cae4a20cf7ba26b55f881789c5cd2692c2badd88a95755bc978a79f16ac634ed252b9860cfd9d717788bd2560b6f7f39df1ac46d25c87ceb8de18
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
[](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
|
5
|
+
Modalist is a powerful & lightweight (not necessarily but primarily ajaxified) modal plugin. Here is how it works:
|
6
6
|
|
7
|
-
1) You
|
8
|
-
2)
|
9
|
-
3)
|
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
|
-
|
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
|
56
|
+
First let's import the necessary assets:
|
55
57
|
|
56
|
-
```
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
```javascript
|
59
|
+
import Modalist from 'modalist';
|
60
|
+
Modalist.init();
|
61
|
+
let modalist = new Modalist;
|
60
62
|
```
|
61
63
|
|
62
|
-
```
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
=
|
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
|
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 '
|
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 '
|
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
|
-
**`
|
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
|
-
=
|
136
|
+
= component 'modalist/closer'
|
138
137
|
|
139
138
|
Content ...
|
140
139
|
```
|
141
140
|
|
142
141
|
### Styles
|
143
142
|
|
144
|
-
|
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#
|
150
|
-
.modalist--content.settings.
|
146
|
+
/* settings#modal */
|
147
|
+
.modalist--content-body.settings.modal {
|
151
148
|
/* ... */
|
152
149
|
}
|
153
|
-
/* nested/settings#
|
154
|
-
.modalist--content.nested.settings.
|
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
|
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,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>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>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>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>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 %>
|
data/lib/modalist/railtie.rb
CHANGED
@@ -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
|
data/lib/modalist/version.rb
CHANGED
data/lib/modalist.rb
CHANGED
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:
|
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-
|
11
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
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:
|
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: '
|
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: '
|
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:
|
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/
|
83
|
-
- app/views/modalist/
|
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
|
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 %>
|