modalist 2.0.0 → 2.1.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: cc9791cd9988e334e98cd849c3eeff2fb56117db6bbdb2773b763b744aae09f7
4
- data.tar.gz: 4c6d521c95218d503b337e9b1aaa0de6419954f962dfb60df1a9ef01b9b50e5c
3
+ metadata.gz: a78c6fdb7a83607e4c7c1986d85877289df20adfe7db50737164c0187fb11e9a
4
+ data.tar.gz: 26633472451d0eaf6a65fafde16b97f5152d87fd4ec4c1529662d80210611444
5
5
  SHA512:
6
- metadata.gz: 9c57d52e6af4fe4554d2382252ddd04c6720b107211c82a160b833cc5ee008223094f565a489eb4fef566cbd2bbe1ba77245dc072d18a1c5893f2dd142ad3d29
7
- data.tar.gz: 1d5c9c45a18cae4a20cf7ba26b55f881789c5cd2692c2badd88a95755bc978a79f16ac634ed252b9860cfd9d717788bd2560b6f7f39df1ac46d25c87ceb8de18
6
+ metadata.gz: dded7573d0cd6bcef736f36b3958e6d940ad6db6d51d4418e5df5f397d0f2547bd84a3eb26bc6164ce313859952a4ca51847d742df06e22f6f6fda012ac73422
7
+ data.tar.gz: 0ee2032d30064e264b6b2851cabbc499877f68a55c92567c4444c312ffb2d0b1da7403da8080e5e50a9ae3125cce403d5103b6e13a199339fa1cfd0ad0c81dc6
data/CHANGELOG.md CHANGED
@@ -4,7 +4,12 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
- ### 2.0.p - 2018/02/09
7
+ ### 2.1.0 - 2018/02/09
8
+
9
+ * enhancements
10
+ * improved modalist view helpers
11
+
12
+ ### 2.0.0 - 2018/02/09
8
13
 
9
14
  * features
10
15
  * updated Modalist.js to 2.0.0
data/README.md CHANGED
@@ -73,15 +73,15 @@ Specify where modals should be located in your view:
73
73
  !!!
74
74
  %html
75
75
  %head
76
- -# ...
76
+ ...
77
77
  %body
78
- = component 'modalist'
78
+ = component 'modalist/wrapper'
79
79
  = yield
80
80
  ```
81
81
 
82
82
  ### Controllers
83
83
 
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:
84
+ Modalist simulates Rails' MVC structure. To add a new modal to your app, you have to create a new controller action, route and view:
85
85
 
86
86
  ```ruby
87
87
  class SettingsController < ApplicationController
@@ -117,27 +117,21 @@ get 'modal', to: 'settings#modal', constraints: Modalist::Ajax.new
117
117
 
118
118
  ### Views
119
119
 
120
- In your Modalist views are a couple of helper methods available:
120
+ In your Modalist view you are able to use the `'modalist'` component to customize the modal:
121
121
 
122
- **`modalist_title(title)`:** This will specify a title for your modal. If you omit this in your view, your modal will not have a header. Takes a string.
123
-
124
- **`modalist_subtitle(subtitle)`:** Add a subtitle to your modal header. Takes a string.
125
-
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.
127
-
128
- **`modalist_closer`:** Renders a default modal close action. Can be passed to `modalist_actions`.
129
-
130
- #### Example
122
+ * `title` This will specify a title for your modal. If you omit this, your modal will not have a header. Takes a string.
123
+ * `subtitle` Add a subtitle to your modal header. Takes a string.
124
+ * `&block` Specify actions (preferably icons wrapped in links) which will be displayed on the right side of your modal header.
131
125
 
132
126
  ```haml
133
- - modalist_title 'Modal'
134
- - modalist_subtitle 'Subtitle'
135
- - modalist_actions do
127
+ = component 'modalist', title: 'Modal', subtitle: 'Subtitle' do
136
128
  = component 'modalist/closer'
137
129
 
138
130
  Content ...
139
131
  ```
140
132
 
133
+ **Note:** The `'modalist/closer'` component renders a default modal close action.
134
+
141
135
  ### Styles
142
136
 
143
137
  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:
@@ -1,18 +1,6 @@
1
1
  module Modalist
2
2
  module ModalHelper
3
3
 
4
- def modalist_title title
5
- area :modalist_title, title
6
- end
7
-
8
- def modalist_subtitle subtitle
9
- area :modalist_subtitle, subtitle
10
- end
11
-
12
- def modalist_actions &block
13
- area :modalist_actions, capture(&block)
14
- end
15
-
16
4
  def modalist_class_hierarchy options = [], delimiter = ' '
17
5
  options.map(&:inspect).join(delimiter).gsub('"', '').gsub(',', '').gsub('[', '').gsub(']', '')
18
6
  end
@@ -1,13 +1,5 @@
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>
1
+ <% area :modalist_title, options[:title] %>
2
+ <% area :modalist_subtitle, options[:subtitle] %>
3
+ <% area :modalist_actions do %>
4
+ <%= block %>
5
+ <% end %>
@@ -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>
@@ -6,6 +6,7 @@ module Modalist
6
6
  initializer 'modalist.mozaic' do
7
7
  Mozaic.configure do |config|
8
8
  config.define_component 'modalist'
9
+ config.define_component 'modalist/wrapper'
9
10
  config.define_component 'modalist/closer'
10
11
  end
11
12
  end
@@ -1,5 +1,5 @@
1
1
  module Modalist
2
2
 
3
- VERSION = '2.0.0'
3
+ VERSION = '2.1.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modalist
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
@@ -95,7 +95,8 @@ files:
95
95
  - app/helpers/modalist/render_helper.rb
96
96
  - app/views/layouts/modalist.html.erb
97
97
  - app/views/mozaic/_modalist.html.erb
98
- - app/views/mozaic/modalist/closer.html.erb
98
+ - app/views/mozaic/modalist/_closer.html.erb
99
+ - app/views/mozaic/modalist/_wrapper.html.erb
99
100
  - lib/modalist.rb
100
101
  - lib/modalist/ajax.rb
101
102
  - lib/modalist/engine.rb