bootstrap-switch-rails 3.2.2 → 3.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0866d75750d14adec48ced7a9ae501729d71cbbd
4
- data.tar.gz: 209da94ec5d44b3d14b748ffd2d19b4f654cfdb2
3
+ metadata.gz: f81c40a85a0c08b852714a69645f87c8fc153004
4
+ data.tar.gz: 2dc6cc63c8037b73c6cf32ecf595e3b43093f7d3
5
5
  SHA512:
6
- metadata.gz: ab70073d9af9a59f2afa2abecbdf835795d49df6bf5c0e865e32ae6368fe74a636de484676c9fe1b4c472b64135a966836593d788a7183682d531c764a589a91
7
- data.tar.gz: 2aa6911b4d399a92dcf6d3b1f1b601166a0a3d7341c0d278968c64a8d182338faef09b7c6d009ae94f50ab013e7f1846e9b8fb8836bd8512be29027907fcc2a2
6
+ metadata.gz: 1e50cd9f4565ee503c5fcb2151368be51fe7442c66926ceef674a64fa7b1ea068e41bbe18b2c37f03bbe2f13aa3a94037133e7120eb2f115bd697abcdc42f8af
7
+ data.tar.gz: 091fe916eb101b8adc426026e3beaa44cb95ca942603bf41edf7b572741b0d97ce8c2b14bef5f5de8ff06d4e80e081cf5da8e0f164923ace8a4cbf8e23aafa23
@@ -1,7 +1,7 @@
1
1
  module Bootstrap
2
2
  module Switch
3
3
  module Rails
4
- VERSION = "3.2.2"
4
+ VERSION = "3.3.0"
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v3.2.2
2
+ * bootstrap-switch - v3.3.0
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -27,6 +27,7 @@
27
27
  var BootstrapSwitch;
28
28
  BootstrapSwitch = (function() {
29
29
  function BootstrapSwitch(element, options) {
30
+ var initInterval;
30
31
  if (options == null) {
31
32
  options = {};
32
33
  }
@@ -109,14 +110,19 @@
109
110
  if (this.options.indeterminate) {
110
111
  this.$element.prop("indeterminate", true);
111
112
  }
112
- this._initWidth();
113
- this._containerPosition(this.options.state, (function(_this) {
113
+ initInterval = window.setInterval((function(_this) {
114
114
  return function() {
115
- if (_this.options.animate) {
116
- return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
115
+ if (_this.$wrapper.is(":visible")) {
116
+ _this._width();
117
+ _this._containerPosition(null, function() {
118
+ if (_this.options.animate) {
119
+ return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
120
+ }
121
+ });
122
+ return window.clearInterval(initInterval);
117
123
  }
118
124
  };
119
- })(this));
125
+ })(this), 50);
120
126
  this._elementHandlers();
121
127
  this._handleHandlers();
122
128
  this._labelHandlers();
@@ -139,10 +145,8 @@
139
145
  }
140
146
  if (this.options.indeterminate) {
141
147
  this.indeterminate(false);
142
- value = true;
143
- } else {
144
- value = !!value;
145
148
  }
149
+ value = !!value;
146
150
  this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip);
147
151
  return this.$element;
148
152
  };
@@ -170,6 +174,7 @@
170
174
  this.$wrapper.addClass("" + this.options.baseClass + "-" + value);
171
175
  }
172
176
  this._width();
177
+ this._containerPosition();
173
178
  this.options.size = value;
174
179
  return this.$element;
175
180
  };
@@ -436,21 +441,6 @@
436
441
  return this.$wrapper.width(this._handleWidth + this._labelWidth);
437
442
  };
438
443
 
439
- BootstrapSwitch.prototype._initWidth = function() {
440
- var widthInterval;
441
- if (this.$wrapper.is(":visible")) {
442
- return this._width();
443
- }
444
- return widthInterval = window.setInterval((function(_this) {
445
- return function() {
446
- if (_this.$wrapper.is(":visible")) {
447
- _this._width();
448
- return window.clearInterval(widthInterval);
449
- }
450
- };
451
- })(this), 50);
452
- };
453
-
454
444
  BootstrapSwitch.prototype._containerPosition = function(state, callback) {
455
445
  if (state == null) {
456
446
  state = this.options.state;
@@ -480,11 +470,9 @@
480
470
  if (!callback) {
481
471
  return;
482
472
  }
483
- if ($.support.transition) {
484
- return this.$container.one("bsTransitionEnd", callback).emulateTransitionEnd(500);
485
- } else {
473
+ return setTimeout(function() {
486
474
  return callback();
487
- }
475
+ }, 50);
488
476
  };
489
477
 
490
478
  BootstrapSwitch.prototype._elementHandlers = function() {
@@ -505,8 +493,8 @@
505
493
  if (_this.$element.is(":radio")) {
506
494
  $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true);
507
495
  }
508
- return _this.$element.trigger("switchChange.bootstrapSwitch", [state]);
509
496
  }
497
+ return _this.$element.trigger("switchChange.bootstrapSwitch", [state]);
510
498
  };
511
499
  })(this),
512
500
  "focus.bootstrapSwitch": (function(_this) {
@@ -543,13 +531,17 @@
543
531
 
544
532
  BootstrapSwitch.prototype._handleHandlers = function() {
545
533
  this.$on.on("click.bootstrapSwitch", (function(_this) {
546
- return function(e) {
534
+ return function(event) {
535
+ event.preventDefault();
536
+ event.stopPropagation();
547
537
  _this.state(false);
548
538
  return _this.$element.trigger("focus.bootstrapSwitch");
549
539
  };
550
540
  })(this));
551
541
  return this.$off.on("click.bootstrapSwitch", (function(_this) {
552
- return function(e) {
542
+ return function(event) {
543
+ event.preventDefault();
544
+ event.stopPropagation();
553
545
  _this.state(true);
554
546
  return _this.$element.trigger("focus.bootstrapSwitch");
555
547
  };
@@ -564,6 +556,7 @@
564
556
  return;
565
557
  }
566
558
  e.preventDefault();
559
+ e.stopPropagation();
567
560
  _this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css("margin-left"), 10);
568
561
  if (_this.options.animate) {
569
562
  _this.$wrapper.removeClass("" + _this.options.baseClass + "-animate");
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v3.2.2
2
+ * bootstrap-switch - v3.3.0
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -48,6 +48,7 @@
48
48
  }
49
49
  .bootstrap-switch {
50
50
  display: inline-block;
51
+ direction: ltr;
51
52
  cursor: pointer;
52
53
  -webkit-border-radius: 5px;
53
54
  -moz-border-radius: 5px;
@@ -64,137 +65,13 @@
64
65
  -o-user-select: none;
65
66
  user-select: none;
66
67
  vertical-align: middle;
67
- min-width: 100px;
68
68
  -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
69
69
  -moz-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
70
70
  -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
71
71
  transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
72
72
  }
73
- .bootstrap-switch.bootstrap-switch-mini {
74
- min-width: 71px;
75
- }
76
- .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,
77
- .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,
78
- .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label {
79
- padding-bottom: 4px;
80
- padding-top: 4px;
81
- font-size: 10px;
82
- line-height: 9px;
83
- }
84
- .bootstrap-switch.bootstrap-switch-small {
85
- min-width: 79px;
86
- }
87
- .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,
88
- .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,
89
- .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label {
90
- padding-bottom: 3px;
91
- padding-top: 3px;
92
- font-size: 12px;
93
- line-height: 18px;
94
- }
95
- .bootstrap-switch.bootstrap-switch-large {
96
- min-width: 120px;
97
- }
98
- .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,
99
- .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,
100
- .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label {
101
- padding-bottom: 9px;
102
- padding-top: 9px;
103
- font-size: 16px;
104
- line-height: normal;
105
- }
106
- .bootstrap-switch.bootstrap-switch-disabled,
107
- .bootstrap-switch.bootstrap-switch-readonly,
108
- .bootstrap-switch.bootstrap-switch-indeterminate {
109
- opacity: 0.5;
110
- filter: alpha(opacity=50);
111
- cursor: default !important;
112
- }
113
- .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,
114
- .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,
115
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,
116
- .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,
117
- .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,
118
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,
119
- .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,
120
- .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label,
121
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label {
122
- cursor: default !important;
123
- }
124
- .bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {
125
- -webkit-transition: margin-left 0.5s;
126
- -moz-transition: margin-left 0.5s;
127
- -o-transition: margin-left 0.5s;
128
- transition: margin-left 0.5s;
129
- }
130
- .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {
131
- -webkit-border-top-left-radius: 0;
132
- -moz-border-radius-topleft: 0;
133
- border-top-left-radius: 0;
134
- -webkit-border-bottom-left-radius: 0;
135
- -moz-border-radius-bottomleft: 0;
136
- border-bottom-left-radius: 0;
137
- -webkit-border-top-right-radius: 4px;
138
- -moz-border-radius-topright: 4px;
139
- border-top-right-radius: 4px;
140
- -webkit-border-bottom-right-radius: 4px;
141
- -moz-border-radius-bottomright: 4px;
142
- border-bottom-right-radius: 4px;
143
- }
144
- .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off {
145
- -webkit-border-top-right-radius: 0;
146
- -moz-border-radius-topright: 0;
147
- border-top-right-radius: 0;
148
- -webkit-border-bottom-right-radius: 0;
149
- -moz-border-radius-bottomright: 0;
150
- border-bottom-right-radius: 0;
151
- -webkit-border-top-left-radius: 4px;
152
- -moz-border-radius-topleft: 4px;
153
- border-top-left-radius: 4px;
154
- -webkit-border-bottom-left-radius: 4px;
155
- -moz-border-radius-bottomleft: 4px;
156
- border-bottom-left-radius: 4px;
157
- }
158
- .bootstrap-switch.bootstrap-switch-focused {
159
- border-color: rgba(82, 168, 236, 0.8);
160
- outline: 0;
161
- outline: thin dotted \9;
162
- -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
163
- -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
164
- box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
165
- }
166
- .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-container,
167
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-container {
168
- margin-left: 0%;
169
- }
170
- .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label,
171
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label {
172
- -webkit-border-top-right-radius: 4px;
173
- -moz-border-radius-topright: 4px;
174
- border-top-right-radius: 4px;
175
- -webkit-border-bottom-right-radius: 4px;
176
- -moz-border-radius-bottomright: 4px;
177
- border-bottom-right-radius: 4px;
178
- }
179
- .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-container,
180
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-container {
181
- margin-left: -50%;
182
- }
183
- .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label,
184
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label {
185
- -webkit-border-top-left-radius: 4px;
186
- -moz-border-radius-topleft: 4px;
187
- border-top-left-radius: 4px;
188
- -webkit-border-bottom-left-radius: 4px;
189
- -moz-border-radius-bottomleft: 4px;
190
- border-bottom-left-radius: 4px;
191
- }
192
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-container {
193
- margin-left: -25%;
194
- }
195
73
  .bootstrap-switch .bootstrap-switch-container {
196
74
  display: inline-block;
197
- width: 150%;
198
75
  top: 0;
199
76
  -webkit-border-radius: 4px;
200
77
  -moz-border-radius: 4px;
@@ -213,8 +90,10 @@
213
90
  cursor: pointer;
214
91
  display: inline-block !important;
215
92
  height: 100%;
216
- padding-bottom: 4px;
217
93
  padding-top: 4px;
94
+ padding-bottom: 4px;
95
+ padding-left: 8px;
96
+ padding-right: 8px;
218
97
  font-size: 14px;
219
98
  line-height: 20px;
220
99
  }
@@ -222,7 +101,6 @@
222
101
  .bootstrap-switch .bootstrap-switch-handle-off {
223
102
  text-align: center;
224
103
  z-index: 1;
225
- width: 33.333333333%;
226
104
  }
227
105
  .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary,
228
106
  .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary {
@@ -469,7 +347,6 @@
469
347
  margin-top: -1px;
470
348
  margin-bottom: -1px;
471
349
  z-index: 100;
472
- width: 33.333333333%;
473
350
  border-left: 1px solid #cccccc;
474
351
  border-right: 1px solid #cccccc;
475
352
  color: #333333;
@@ -531,3 +408,111 @@
531
408
  .bootstrap-switch input[type='checkbox'].form-control {
532
409
  height: auto;
533
410
  }
411
+ .bootstrap-switch.bootstrap-switch-mini {
412
+ min-width: 71px;
413
+ }
414
+ .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,
415
+ .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,
416
+ .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label {
417
+ padding: 3px 6px;
418
+ font-size: 10px;
419
+ line-height: 9px;
420
+ }
421
+ .bootstrap-switch.bootstrap-switch-small {
422
+ min-width: 79px;
423
+ }
424
+ .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,
425
+ .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,
426
+ .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label {
427
+ padding: 3px 6px;
428
+ font-size: 12px;
429
+ line-height: 18px;
430
+ }
431
+ .bootstrap-switch.bootstrap-switch-large {
432
+ min-width: 120px;
433
+ }
434
+ .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,
435
+ .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,
436
+ .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label {
437
+ padding: 9px 12px;
438
+ font-size: 16px;
439
+ line-height: normal;
440
+ }
441
+ .bootstrap-switch.bootstrap-switch-disabled,
442
+ .bootstrap-switch.bootstrap-switch-readonly,
443
+ .bootstrap-switch.bootstrap-switch-indeterminate {
444
+ cursor: default !important;
445
+ }
446
+ .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,
447
+ .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,
448
+ .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,
449
+ .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,
450
+ .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,
451
+ .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,
452
+ .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,
453
+ .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label,
454
+ .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label {
455
+ opacity: 0.5;
456
+ filter: alpha(opacity=50);
457
+ cursor: default !important;
458
+ }
459
+ .bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {
460
+ -webkit-transition: margin-left 0.5s;
461
+ -moz-transition: margin-left 0.5s;
462
+ -o-transition: margin-left 0.5s;
463
+ transition: margin-left 0.5s;
464
+ }
465
+ .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {
466
+ -webkit-border-top-left-radius: 0;
467
+ -moz-border-radius-topleft: 0;
468
+ border-top-left-radius: 0;
469
+ -webkit-border-bottom-left-radius: 0;
470
+ -moz-border-radius-bottomleft: 0;
471
+ border-bottom-left-radius: 0;
472
+ -webkit-border-top-right-radius: 4px;
473
+ -moz-border-radius-topright: 4px;
474
+ border-top-right-radius: 4px;
475
+ -webkit-border-bottom-right-radius: 4px;
476
+ -moz-border-radius-bottomright: 4px;
477
+ border-bottom-right-radius: 4px;
478
+ }
479
+ .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off {
480
+ -webkit-border-top-right-radius: 0;
481
+ -moz-border-radius-topright: 0;
482
+ border-top-right-radius: 0;
483
+ -webkit-border-bottom-right-radius: 0;
484
+ -moz-border-radius-bottomright: 0;
485
+ border-bottom-right-radius: 0;
486
+ -webkit-border-top-left-radius: 4px;
487
+ -moz-border-radius-topleft: 4px;
488
+ border-top-left-radius: 4px;
489
+ -webkit-border-bottom-left-radius: 4px;
490
+ -moz-border-radius-bottomleft: 4px;
491
+ border-bottom-left-radius: 4px;
492
+ }
493
+ .bootstrap-switch.bootstrap-switch-focused {
494
+ border-color: rgba(82, 168, 236, 0.8);
495
+ outline: 0;
496
+ outline: thin dotted \9;
497
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
498
+ -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
499
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
500
+ }
501
+ .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label,
502
+ .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label {
503
+ -webkit-border-top-right-radius: 4px;
504
+ -moz-border-radius-topright: 4px;
505
+ border-top-right-radius: 4px;
506
+ -webkit-border-bottom-right-radius: 4px;
507
+ -moz-border-radius-bottomright: 4px;
508
+ border-bottom-right-radius: 4px;
509
+ }
510
+ .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label,
511
+ .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label {
512
+ -webkit-border-top-left-radius: 4px;
513
+ -moz-border-radius-topleft: 4px;
514
+ border-top-left-radius: 4px;
515
+ -webkit-border-bottom-left-radius: 4px;
516
+ -moz-border-radius-bottomleft: 4px;
517
+ border-bottom-left-radius: 4px;
518
+ }
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v3.2.2
2
+ * bootstrap-switch - v3.3.0
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -21,6 +21,7 @@
21
21
 
22
22
  .bootstrap-switch {
23
23
  display: inline-block;
24
+ direction: ltr;
24
25
  cursor: pointer;
25
26
  border-radius: 4px;
26
27
  border: 1px solid;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-switch-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel van Rijn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2014-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler