alertifyjs-rails 0.1.6 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # alertifyjs-rails
2
2
 
3
- This gem provides [alertify.js](http://alertifyjs.com/) (v1.0.1) for Rails.
3
+ This gem provides [alertify.js](http://alertifyjs.com/) (v1.2.0) for Rails.
4
4
 
5
5
 
6
6
  ## Installation
@@ -1,6 +1,6 @@
1
1
  module Alertifyjs #:nodoc:
2
2
  module Rails #:nodoc:
3
- VERSION = "0.1.6"
4
- ALERTIFYJS_VERSION = "1.0.1"
3
+ VERSION = "1.2.0"
4
+ ALERTIFYJS_VERSION = "1.2.0"
5
5
  end
6
6
  end
@@ -7,7 +7,7 @@
7
7
  * @license MIT <http://opensource.org/licenses/mit-license.php>
8
8
  * @link http://alertifyjs.com
9
9
  * @module AlertifyJS
10
- * @version 1.0.1
10
+ * @version 1.2.0
11
11
  */
12
12
  ( function ( window ) {
13
13
  'use strict';
@@ -35,6 +35,7 @@
35
35
  movable:true,
36
36
  resizable:true,
37
37
  closable:true,
38
+ closableByDimmer:true,
38
39
  maximizable:true,
39
40
  startMaximized:false,
40
41
  pinnable:true,
@@ -280,6 +281,7 @@
280
281
  modeless: 'ajs-modeless',
281
282
  movable: 'ajs-movable',
282
283
  resizable: 'ajs-resizable',
284
+ capture: 'ajs-capture',
283
285
  fixed: 'ajs-fixed',
284
286
  closable:'ajs-closable',
285
287
  maximizable:'ajs-maximizable',
@@ -333,6 +335,11 @@
333
335
  }
334
336
  };
335
337
  }
338
+
339
+ //initialize hooks object.
340
+ if(typeof instance.hooks !== 'object'){
341
+ instance.hooks = {};
342
+ }
336
343
 
337
344
  var internal = instance.__internal = {
338
345
  /**
@@ -362,6 +369,7 @@
362
369
  movable: undefined,
363
370
  resizable: undefined,
364
371
  closable: undefined,
372
+ closableByDimmer: undefined,
365
373
  maximizable: undefined,
366
374
  startMaximized: undefined,
367
375
  pinnable: undefined,
@@ -487,6 +495,7 @@
487
495
  instance.set('resizable', setup.options.resizable === undefined ? alertify.defaults.resizable : setup.options.resizable);
488
496
 
489
497
  instance.set('closable', setup.options.closable === undefined ? alertify.defaults.closable : setup.options.closable);
498
+ instance.set('closableByDimmer', setup.options.closableByDimmer === undefined ? alertify.defaults.closableByDimmer : setup.options.closableByDimmer);
490
499
  instance.set('maximizable', setup.options.maximizable === undefined ? alertify.defaults.maximizable : setup.options.maximizable);
491
500
  instance.set('startMaximized', setup.options.startMaximized === undefined ? alertify.defaults.startMaximized : setup.options.startMaximized);
492
501
 
@@ -707,6 +716,11 @@
707
716
  updateTransition(instance,newValue, oldValue);
708
717
  break;
709
718
  }
719
+
720
+ // internal on option updated event
721
+ if(typeof instance.hooks.onupdate === 'function'){
722
+ instance.hooks.onupdate.call(instance, option, oldValue, newValue);
723
+ }
710
724
  }
711
725
 
712
726
  /**
@@ -1041,7 +1055,7 @@
1041
1055
  */
1042
1056
  function modalClickHandler(event, instance) {
1043
1057
  var target = event.srcElement || event.target;
1044
- if (!cancelClick && target === instance.elements.modal) {
1058
+ if (!cancelClick && target === instance.elements.modal && instance.get('closableByDimmer') === true) {
1045
1059
  triggerClose(instance);
1046
1060
  }
1047
1061
  cancelClick = false;
@@ -1376,6 +1390,7 @@
1376
1390
  offsetY = eventSrc[yProp];
1377
1391
 
1378
1392
  var element = instance.elements.dialog;
1393
+ addClass(element, classes.capture);
1379
1394
 
1380
1395
  if (element.style.left) {
1381
1396
  offsetX -= parseInt(element.style.left, 10);
@@ -1422,8 +1437,10 @@
1422
1437
  */
1423
1438
  function endMove() {
1424
1439
  if (movable) {
1440
+ var element = movable.elements.dialog;
1425
1441
  movable = null;
1426
1442
  removeClass(document.body, classes.noSelection);
1443
+ removeClass(element, classes.capture);
1427
1444
  }
1428
1445
  }
1429
1446
 
@@ -1566,6 +1583,7 @@
1566
1583
  resizable = instance;
1567
1584
  handleOffset = instance.elements.resizeHandle.offsetHeight / 2;
1568
1585
  var element = instance.elements.dialog;
1586
+ addClass(element, classes.capture);
1569
1587
  startingLeft = parseInt(element.style.left, 10);
1570
1588
  element.style.height = element.offsetHeight + 'px';
1571
1589
  element.style.minHeight = instance.elements.header.offsetHeight + instance.elements.footer.offsetHeight + 'px';
@@ -1611,8 +1629,10 @@
1611
1629
  */
1612
1630
  function endResize() {
1613
1631
  if (resizable) {
1632
+ var element = resizable.elements.dialog;
1614
1633
  resizable = null;
1615
1634
  removeClass(document.body, classes.noSelection);
1635
+ removeClass(element, classes.capture);
1616
1636
  cancelClick = true;
1617
1637
  }
1618
1638
  }
@@ -2139,6 +2159,11 @@
2139
2159
  // show dialog
2140
2160
  removeClass(this.elements.root, classes.hidden);
2141
2161
 
2162
+ // internal on show event
2163
+ if(typeof this.hooks.onshow === 'function'){
2164
+ this.hooks.onshow.call(this);
2165
+ }
2166
+
2142
2167
  // allow custom `onshow` method
2143
2168
  if ( typeof this.get('onshow') === 'function' ) {
2144
2169
  this.get('onshow')();
@@ -2184,6 +2209,11 @@
2184
2209
  removeClass(this.elements.root, this.__internal.className);
2185
2210
  }
2186
2211
 
2212
+ // internal on close event
2213
+ if(typeof this.hooks.onclose === 'function'){
2214
+ this.hooks.onclose.call(this);
2215
+ }
2216
+
2187
2217
  // allow custom `onclose` method
2188
2218
  if ( typeof this.get('onclose') === 'function' ) {
2189
2219
  this.get('onclose')();
@@ -2241,7 +2271,7 @@
2241
2271
  }
2242
2272
 
2243
2273
  //add to DOM tree.
2244
- if (element.parentNode != document.body) {
2274
+ if (element.parentNode !== document.body) {
2245
2275
  document.body.appendChild(element);
2246
2276
  }
2247
2277
  }
@@ -3218,13 +3248,17 @@
3218
3248
  };
3219
3249
  });
3220
3250
 
3221
- // AMD and window support
3222
- if ( typeof define === 'function' ) {
3251
+ // CommonJS
3252
+ if ( typeof module === 'object' && typeof module.exports === 'object' ) {
3253
+ module.exports = alertify;
3254
+ // AMD
3255
+ } else if ( typeof define === 'function' ) {
3223
3256
  define( [], function () {
3224
3257
  return alertify;
3225
3258
  } );
3259
+ // window
3226
3260
  } else if ( !window.alertify ) {
3227
3261
  window.alertify = alertify;
3228
3262
  }
3229
3263
 
3230
- } ( this ) );
3264
+ } ( typeof window !== 'undefined' ? window : this ) );
@@ -28,6 +28,16 @@
28
28
  padding: 24px 24px 0 24px;
29
29
  outline: 0;
30
30
  }
31
+ .alertify .ajs-dialog.ajs-capture:before {
32
+ content: '';
33
+ position: absolute;
34
+ top: 0;
35
+ right: 0;
36
+ bottom: 0;
37
+ left: 0;
38
+ display: block;
39
+ z-index: 1;
40
+ }
31
41
  .alertify .ajs-reset {
32
42
  position: absolute !important;
33
43
  display: inline !important;
@@ -39,7 +49,7 @@
39
49
  position: absolute;
40
50
  right: 4px;
41
51
  margin: -14px 24px 0 0;
42
- z-index: 1;
52
+ z-index: 2;
43
53
  }
44
54
  .alertify .ajs-commands button {
45
55
  display: none;
@@ -101,6 +111,7 @@
101
111
  height: 10px;
102
112
  right: 0;
103
113
  bottom: 0;
114
+ z-index: 1;
104
115
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMS8xNEDQYmMAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAQ0lEQVQYlaXNMQoAIAxD0dT7H657l0KX3iJuUlBUNOsPPCGJm7VDp6ryeMxMuDsAQH7owW3pyn3RS26iKxERMLN3ugOaAkaL3sWVigAAAABJRU5ErkJggg==);
105
116
  -webkit-transform: scaleX(1) /*rtl:scaleX(-1)*/;
106
117
  transform: scaleX(1) /*rtl:scaleX(-1)*/;
@@ -226,7 +237,17 @@
226
237
  .alertify.ajs-basic .ajs-footer {
227
238
  visibility: hidden;
228
239
  }
229
- .alertify.ajs-frameless .ajs-header,
240
+ .alertify.ajs-frameless .ajs-header {
241
+ position: absolute;
242
+ top: 0;
243
+ left: 0;
244
+ right: 0;
245
+ min-height: 60px;
246
+ margin: 0;
247
+ padding: 0;
248
+ opacity: 0;
249
+ z-index: 1;
250
+ }
230
251
  .alertify.ajs-frameless .ajs-footer {
231
252
  display: none;
232
253
  }
@@ -28,6 +28,16 @@
28
28
  padding: 24px 24px 0 24px;
29
29
  outline: 0;
30
30
  }
31
+ .alertify .ajs-dialog.ajs-capture:before {
32
+ content: '';
33
+ position: absolute;
34
+ top: 0;
35
+ left: 0;
36
+ bottom: 0;
37
+ right: 0;
38
+ display: block;
39
+ z-index: 1;
40
+ }
31
41
  .alertify .ajs-reset {
32
42
  position: absolute !important;
33
43
  display: inline !important;
@@ -39,7 +49,7 @@
39
49
  position: absolute;
40
50
  left: 4px;
41
51
  margin: -14px 0 0 24px;
42
- z-index: 1;
52
+ z-index: 2;
43
53
  }
44
54
  .alertify .ajs-commands button {
45
55
  display: none;
@@ -101,6 +111,7 @@
101
111
  height: 10px;
102
112
  left: 0;
103
113
  bottom: 0;
114
+ z-index: 1;
104
115
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNy8xMS8xNEDQYmMAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAQ0lEQVQYlaXNMQoAIAxD0dT7H657l0KX3iJuUlBUNOsPPCGJm7VDp6ryeMxMuDsAQH7owW3pyn3RS26iKxERMLN3ugOaAkaL3sWVigAAAABJRU5ErkJggg==);
105
116
  -webkit-transform: scaleX(-1);
106
117
  transform: scaleX(-1);
@@ -226,7 +237,17 @@
226
237
  .alertify.ajs-basic .ajs-footer {
227
238
  visibility: hidden;
228
239
  }
229
- .alertify.ajs-frameless .ajs-header,
240
+ .alertify.ajs-frameless .ajs-header {
241
+ position: absolute;
242
+ top: 0;
243
+ right: 0;
244
+ left: 0;
245
+ min-height: 60px;
246
+ margin: 0;
247
+ padding: 0;
248
+ opacity: 0;
249
+ z-index: 1;
250
+ }
230
251
  .alertify.ajs-frameless .ajs-footer {
231
252
  display: none;
232
253
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alertifyjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-11 00:00:00.000000000 Z
12
+ date: 2015-02-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Use Alertify.js (alertifyjs.com) with Rails 3 and 4
15
15
  email: