noty-rails 2.2.9 → 2.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca580a2be55891d4803c5de65cae38a3909c1333
4
- data.tar.gz: bc39145e91daa32bf7466f7144b23d0f312d076f
3
+ metadata.gz: b3875c38e0ff1bc8e104554a822281ae755b50e4
4
+ data.tar.gz: 1026bfe78c00b701358677d1ac068a74a17ff9ce
5
5
  SHA512:
6
- metadata.gz: d0c4413685ca93c8f3454c5fd3bcc353da2dc972671221642d0fd112a5c8a3839dda57029585d6c89b716c334f75d84f71b09b5033271d0fd68b92d002e7fb53
7
- data.tar.gz: 2e434fb2bef47217773f17d00622fc2a32ab3f6487e98e967102ee5834b2f933c3181ca6cd891fd91184aff7ef47aaecd9cfe75c015375d9bc65321665b69ec9
6
+ metadata.gz: 834fcee1826aaa00f5eefbb3af5b9d0f2183b2d64d593b4292d1434cdf96a1e75c8d96614f5978fcaec0368ec8a9a80827249289011f0eae0725d90d7b15e584
7
+ data.tar.gz: 0c315652d904a0a2ff4cd03c0d1620e8a5655dd80be7a4951e430782ae755bb8097ce6c38cbf30682f47e03735b7fb0902e756f61095f4c045ee650665544418
data/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  Rails asset-pipeline gem to provide [Noty](http://needim.github.com/noty/)
2
2
 
3
+ # Deprecation Note
4
+ There are multiple ways for managing this JS library already (or any library that is supported by bower):
5
+ - [bower-rails](https://github.com/rharriso/bower-rails)
6
+ - [Rails Assets](https://rails-assets.org/)
7
+
8
+ This gem will be updated until a major release is done in the upstream.
9
+
3
10
  # Install
4
11
  ```ruby
5
12
  gem 'noty-rails'
@@ -27,6 +34,10 @@ $.noty.defaults.layout = 'bottom'
27
34
 
28
35
  # Changelog
29
36
 
37
+ ### 2.3.4
38
+
39
+ - Update Noty to `2.3.4`
40
+
30
41
  ### 2.2.9
31
42
 
32
43
  - Update Noty to `2.2.9`
@@ -1,5 +1,5 @@
1
1
  module Noty
2
2
  module Rails
3
- VERSION = "2.2.9".freeze
3
+ VERSION = "2.3.4".freeze
4
4
  end
5
5
  end
@@ -17,4 +17,9 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
+ s.post_install_message = %Q(
21
+ This gem is deprecated.
22
+ Please read the deprecation note on README.
23
+ )
24
+
20
25
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  @package noty - jQuery Notification Plugin
3
- @version version: 2.2.9
3
+ @version version: 2.3.4
4
4
  @contributors https://github.com/needim/noty/graphs/contributors
5
5
 
6
6
  @documentation Examples and Documentation - http://needim.github.com/noty/
@@ -8,17 +8,15 @@
8
8
  @license Licensed under the MIT licenses: http://www.opensource.org/licenses/mit-license.php
9
9
  */
10
10
 
11
- if(typeof Object.create !== 'function') {
12
- Object.create = function(o) {
13
- function F() {
14
- }
15
-
16
- F.prototype = o;
17
- return new F();
18
- };
19
- }
11
+ if(typeof Object.create !== 'function') {
12
+ Object.create = function(o) {
13
+ function F() {
14
+ }
20
15
 
21
- (function($) {
16
+ F.prototype = o;
17
+ return new F();
18
+ };
19
+ }
22
20
 
23
21
  var NotyObject = {
24
22
 
@@ -76,9 +74,9 @@ if(typeof Object.create !== 'function') {
76
74
  $.each(this.options.buttons, function(i, button) {
77
75
  var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text).attr('id', button.id ? button.id : 'button-' + i)
78
76
  .appendTo(self.$bar.find('.noty_buttons'))
79
- .on('click', function() {
77
+ .on('click', function(event) {
80
78
  if($.isFunction(button.onClick)) {
81
- button.onClick.call($button, self);
79
+ button.onClick.call($button, self, event);
82
80
  }
83
81
  });
84
82
  });
@@ -139,16 +137,26 @@ if(typeof Object.create !== 'function') {
139
137
  if(self.options.callback.onShow)
140
138
  self.options.callback.onShow.apply(self);
141
139
 
142
- self.$bar.animate(
143
- self.options.animation.open,
144
- self.options.animation.speed,
145
- self.options.animation.easing,
146
- function() {
140
+ if (typeof self.options.animation.open == 'string') {
141
+ self.$bar.css('height', self.$bar.innerHeight());
142
+ self.$bar.show().addClass(self.options.animation.open).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
147
143
  if(self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
148
144
  self.showing = false;
149
145
  self.shown = true;
150
146
  });
151
147
 
148
+ } else {
149
+ self.$bar.animate(
150
+ self.options.animation.open,
151
+ self.options.animation.speed,
152
+ self.options.animation.easing,
153
+ function() {
154
+ if(self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
155
+ self.showing = false;
156
+ self.shown = true;
157
+ });
158
+ }
159
+
152
160
  // If noty is have a timeout option
153
161
  if(self.options.timeout)
154
162
  self.$bar.delay(self.options.timeout).promise().done(function() {
@@ -175,8 +183,6 @@ if(typeof Object.create !== 'function') {
175
183
  return;
176
184
  }
177
185
 
178
- this.$bar.dequeue();
179
-
180
186
  if(!this.shown && !this.showing) { // If we are still waiting in the queue just delete from queue
181
187
  var queue = [];
182
188
  $.each($.noty.queue, function(i, n) {
@@ -194,53 +200,81 @@ if(typeof Object.create !== 'function') {
194
200
  self.options.callback.onClose.apply(self);
195
201
  }
196
202
 
197
- self.$bar.clearQueue().stop().animate(
198
- self.options.animation.close,
199
- self.options.animation.speed,
200
- self.options.animation.easing,
201
- function() {
203
+ if (typeof self.options.animation.close == 'string') {
204
+ self.$bar.addClass(self.options.animation.close).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
202
205
  if(self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
203
- })
204
- .promise().done(function() {
205
-
206
- // Modal Cleaning
207
- if(self.options.modal) {
208
- $.notyRenderer.setModalCount(-1);
209
- if($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut('fast', function() {
210
- $(this).remove();
211
- });
212
- }
206
+ self.closeCleanUp();
207
+ });
208
+ } else {
209
+ self.$bar.clearQueue().stop().animate(
210
+ self.options.animation.close,
211
+ self.options.animation.speed,
212
+ self.options.animation.easing,
213
+ function() {
214
+ if(self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
215
+ })
216
+ .promise().done(function() {
217
+ self.closeCleanUp();
218
+ });
219
+ }
213
220
 
214
- // Layout Cleaning
215
- $.notyRenderer.setLayoutCountFor(self, -1);
216
- if($.notyRenderer.getLayoutCountFor(self) == 0) $(self.options.layout.container.selector).remove();
221
+ }, // end close
222
+
223
+ closeCleanUp: function() {
224
+
225
+ var self = this;
217
226
 
218
- // Make sure self.$bar has not been removed before attempting to remove it
219
- if(typeof self.$bar !== 'undefined' && self.$bar !== null) {
227
+ // Modal Cleaning
228
+ if(self.options.modal) {
229
+ $.notyRenderer.setModalCount(-1);
230
+ if($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut('fast', function() {
231
+ $(this).remove();
232
+ });
233
+ }
234
+
235
+ // Layout Cleaning
236
+ $.notyRenderer.setLayoutCountFor(self, -1);
237
+ if($.notyRenderer.getLayoutCountFor(self) == 0) $(self.options.layout.container.selector).remove();
238
+
239
+ // Make sure self.$bar has not been removed before attempting to remove it
240
+ if(typeof self.$bar !== 'undefined' && self.$bar !== null) {
241
+
242
+ if (typeof self.options.animation.close == 'string') {
243
+ self.$bar.css('transition', 'all 100ms ease').css('border', 0).css('margin', 0).height(0);
244
+ self.$bar.one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() {
220
245
  self.$bar.remove();
221
246
  self.$bar = null;
222
247
  self.closed = true;
223
- }
224
248
 
225
- delete $.noty.store[self.options.id]; // deleting noty from store
249
+ if(self.options.theme.callback && self.options.theme.callback.onClose) {
250
+ self.options.theme.callback.onClose.apply(self);
251
+ }
252
+ });
253
+ } else {
254
+ self.$bar.remove();
255
+ self.$bar = null;
256
+ self.closed = true;
257
+ }
258
+ }
226
259
 
227
- if(self.options.theme.callback && self.options.theme.callback.onClose) {
228
- self.options.theme.callback.onClose.apply(self);
229
- }
260
+ delete $.noty.store[self.options.id]; // deleting noty from store
230
261
 
231
- if(!self.options.dismissQueue) {
232
- // Queue render
233
- $.noty.ontap = true;
262
+ if(self.options.theme.callback && self.options.theme.callback.onClose) {
263
+ self.options.theme.callback.onClose.apply(self);
264
+ }
234
265
 
235
- $.notyRenderer.render();
236
- }
266
+ if(!self.options.dismissQueue) {
267
+ // Queue render
268
+ $.noty.ontap = true;
237
269
 
238
- if(self.options.maxVisible > 0 && self.options.dismissQueue) {
239
- $.notyRenderer.render();
240
- }
241
- })
270
+ $.notyRenderer.render();
271
+ }
242
272
 
243
- }, // end close
273
+ if(self.options.maxVisible > 0 && self.options.dismissQueue) {
274
+ $.notyRenderer.render();
275
+ }
276
+
277
+ }, // end close clean up
244
278
 
245
279
  setText: function(text) {
246
280
  if(!this.closed) {
@@ -494,9 +528,7 @@ if(typeof Object.create !== 'function') {
494
528
  });
495
529
  });
496
530
 
497
- })(jQuery);
498
-
499
- // Helpers
500
- window.noty = function noty(options) {
501
- return jQuery.notyRenderer.init(options);
502
- };
531
+ // Helpers
532
+ window.noty = function noty(options) {
533
+ return jQuery.notyRenderer.init(options);
534
+ };
@@ -1,34 +1,30 @@
1
- (function($) {
2
-
3
- $.noty.layouts.bottom = {
4
- name : 'bottom',
5
- options : {},
6
- container: {
7
- object : '<ul id="noty_bottom_layout_container" />',
8
- selector: 'ul#noty_bottom_layout_container',
9
- style : function() {
10
- $(this).css({
11
- bottom : 0,
12
- left : '5%',
13
- position : 'fixed',
14
- width : '90%',
15
- height : 'auto',
16
- margin : 0,
17
- padding : 0,
18
- listStyleType: 'none',
19
- zIndex : 9999999
20
- });
21
- }
22
- },
23
- parent : {
24
- object : '<li />',
25
- selector: 'li',
26
- css : {}
27
- },
28
- css : {
29
- display: 'none'
30
- },
31
- addClass : ''
32
- };
33
-
34
- })(jQuery);
1
+ $.noty.layouts.bottom = {
2
+ name : 'bottom',
3
+ options : {},
4
+ container: {
5
+ object : '<ul id="noty_bottom_layout_container" />',
6
+ selector: 'ul#noty_bottom_layout_container',
7
+ style : function() {
8
+ $(this).css({
9
+ bottom : 0,
10
+ left : '5%',
11
+ position : 'fixed',
12
+ width : '90%',
13
+ height : 'auto',
14
+ margin : 0,
15
+ padding : 0,
16
+ listStyleType: 'none',
17
+ zIndex : 9999999
18
+ });
19
+ }
20
+ },
21
+ parent : {
22
+ object : '<li />',
23
+ selector: 'li',
24
+ css : {}
25
+ },
26
+ css : {
27
+ display: 'none'
28
+ },
29
+ addClass : ''
30
+ };
@@ -1,41 +1,38 @@
1
- (function($) {
1
+ $.noty.layouts.bottomCenter = {
2
+ name : 'bottomCenter',
3
+ options : { // overrides options
2
4
 
3
- $.noty.layouts.bottomCenter = {
4
- name : 'bottomCenter',
5
- options : { // overrides options
5
+ },
6
+ container: {
7
+ object : '<ul id="noty_bottomCenter_layout_container" />',
8
+ selector: 'ul#noty_bottomCenter_layout_container',
9
+ style : function() {
10
+ $(this).css({
11
+ bottom : 20,
12
+ left : 0,
13
+ position : 'fixed',
14
+ width : '310px',
15
+ height : 'auto',
16
+ margin : 0,
17
+ padding : 0,
18
+ listStyleType: 'none',
19
+ zIndex : 10000000
20
+ });
6
21
 
7
- },
8
- container: {
9
- object : '<ul id="noty_bottomCenter_layout_container" />',
10
- selector: 'ul#noty_bottomCenter_layout_container',
11
- style : function() {
12
- $(this).css({
13
- bottom : 20,
14
- left : 0,
15
- position : 'fixed',
16
- width : '310px',
17
- height : 'auto',
18
- margin : 0,
19
- padding : 0,
20
- listStyleType: 'none',
21
- zIndex : 10000000
22
- });
22
+ $(this).css({
23
+ left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px'
24
+ });
25
+ }
26
+ },
27
+ parent : {
28
+ object : '<li />',
29
+ selector: 'li',
30
+ css : {}
31
+ },
32
+ css : {
33
+ display: 'none',
34
+ width : '310px'
35
+ },
36
+ addClass : ''
37
+ };
23
38
 
24
- $(this).css({
25
- left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px'
26
- });
27
- }
28
- },
29
- parent : {
30
- object : '<li />',
31
- selector: 'li',
32
- css : {}
33
- },
34
- css : {
35
- display: 'none',
36
- width : '310px'
37
- },
38
- addClass : ''
39
- };
40
-
41
- })(jQuery);
@@ -1,43 +1,39 @@
1
- (function($) {
1
+ $.noty.layouts.bottomLeft = {
2
+ name : 'bottomLeft',
3
+ options : { // overrides options
2
4
 
3
- $.noty.layouts.bottomLeft = {
4
- name : 'bottomLeft',
5
- options : { // overrides options
5
+ },
6
+ container: {
7
+ object : '<ul id="noty_bottomLeft_layout_container" />',
8
+ selector: 'ul#noty_bottomLeft_layout_container',
9
+ style : function() {
10
+ $(this).css({
11
+ bottom : 20,
12
+ left : 20,
13
+ position : 'fixed',
14
+ width : '310px',
15
+ height : 'auto',
16
+ margin : 0,
17
+ padding : 0,
18
+ listStyleType: 'none',
19
+ zIndex : 10000000
20
+ });
6
21
 
7
- },
8
- container: {
9
- object : '<ul id="noty_bottomLeft_layout_container" />',
10
- selector: 'ul#noty_bottomLeft_layout_container',
11
- style : function() {
22
+ if(window.innerWidth < 600) {
12
23
  $(this).css({
13
- bottom : 20,
14
- left : 20,
15
- position : 'fixed',
16
- width : '310px',
17
- height : 'auto',
18
- margin : 0,
19
- padding : 0,
20
- listStyleType: 'none',
21
- zIndex : 10000000
24
+ left: 5
22
25
  });
23
-
24
- if(window.innerWidth < 600) {
25
- $(this).css({
26
- left: 5
27
- });
28
- }
29
26
  }
30
- },
31
- parent : {
32
- object : '<li />',
33
- selector: 'li',
34
- css : {}
35
- },
36
- css : {
37
- display: 'none',
38
- width : '310px'
39
- },
40
- addClass : ''
41
- };
42
-
43
- })(jQuery);
27
+ }
28
+ },
29
+ parent : {
30
+ object : '<li />',
31
+ selector: 'li',
32
+ css : {}
33
+ },
34
+ css : {
35
+ display: 'none',
36
+ width : '310px'
37
+ },
38
+ addClass : ''
39
+ };