bootstrap-switch-rails 3.1.0 → 3.2.2

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
  SHA1:
3
- metadata.gz: 72af57b158c9781bb620e08b3b8641b4347a218a
4
- data.tar.gz: f4ed924cbea87c7db4baa5562191ff4052febfc3
3
+ metadata.gz: 0866d75750d14adec48ced7a9ae501729d71cbbd
4
+ data.tar.gz: 209da94ec5d44b3d14b748ffd2d19b4f654cfdb2
5
5
  SHA512:
6
- metadata.gz: 7f97ae70cdf5bfb20990c13b173eec109675f22d4ad25d24273ef3f4d5b3fa1d9297f9982ceca8fba737ff9a65d79855aade0bc27b2112c7f4550b9b5b7db3cd
7
- data.tar.gz: 97609bc762168f87f03b5c68a83d7533fd2b1eee785b910a7984eefdf72328340d44bc1e53599ce24d04f64a001e7b95494b0d7122fd0974ef2d7076d02d6f80
6
+ metadata.gz: ab70073d9af9a59f2afa2abecbdf835795d49df6bf5c0e865e32ae6368fe74a636de484676c9fe1b4c472b64135a966836593d788a7183682d531c764a589a91
7
+ data.tar.gz: 2aa6911b4d399a92dcf6d3b1f1b601166a0a3d7341c0d278968c64a8d182338faef09b7c6d009ae94f50ab013e7f1846e9b8fb8836bd8512be29027907fcc2a2
data/README.md CHANGED
@@ -48,22 +48,6 @@ or in any `SASS` file, include the following:
48
48
 
49
49
  See the [demo page of Mattia Larentis](http://www.bootstrap-switch.org/) for examples how to use the plugin
50
50
 
51
- ## Changes
52
-
53
- | Version | Notes |
54
- | -------:| ----------------------------------------------------------------------------------- |
55
- | 3.1.2 | Update to v3.1.2 of the bootstrap-switch plugin |
56
- | 3.0.2 | Update to v3.0.2 of the bootstrap-switch plugin |
57
- | 3.0.0 | Update to v3.0.0 of the bootstrap-switch plugin |
58
- | 2.0.2 | Fixed issue where bootstrap 2 sass wasn't compiling (issue #7) |
59
- | 2.0.1 | Update to v2.0.1 of the bootstrap-switch plugin |
60
- | 2.0.0 | Update to v2.0 of the bootstrap-switch plugin |
61
- | 1.9.0 | Update to v1.9 of the bootstrap-switch plugin |
62
- | 1.8.0 | Update to v1.8 of the bootstrap-switch plugin |
63
- | 1.4.0 | Update to v1.4 of the bootstrap-switch plugin and make version equal to the plugin |
64
- | 0.1.1 | Update to v1.3 of the bootstrap-switch plugin |
65
- | 0.1.0 | Initial release |
66
-
67
51
  ## License
68
52
 
69
53
  * The [bootstrap-switch](http://www.bootstrap-switch.org/) plugin is licensed under the
@@ -1,7 +1,7 @@
1
1
  module Bootstrap
2
2
  module Switch
3
3
  module Rails
4
- VERSION = "3.1.0"
4
+ VERSION = "3.2.2"
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v3.1.0
2
+ * bootstrap-switch - v3.2.2
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -45,6 +45,8 @@
45
45
  onText: this.$element.data("on-text"),
46
46
  offText: this.$element.data("off-text"),
47
47
  labelText: this.$element.data("label-text"),
48
+ handleWidth: this.$element.data("handle-width"),
49
+ labelWidth: this.$element.data("label-width"),
48
50
  baseClass: this.$element.data("base-class"),
49
51
  wrapperClass: this.$element.data("wrapper-class")
50
52
  }, options);
@@ -57,9 +59,6 @@
57
59
  if (_this.options.size != null) {
58
60
  classes.push("" + _this.options.baseClass + "-" + _this.options.size);
59
61
  }
60
- if (_this.options.animate) {
61
- classes.push("" + _this.options.baseClass + "-animate");
62
- }
63
62
  if (_this.options.disabled) {
64
63
  classes.push("" + _this.options.baseClass + "-disabled");
65
64
  }
@@ -90,13 +89,10 @@
90
89
  html: this.options.offText,
91
90
  "class": "" + this.options.baseClass + "-handle-off " + this.options.baseClass + "-" + this.options.offColor
92
91
  });
93
- this.$label = $("<label>", {
92
+ this.$label = $("<span>", {
94
93
  html: this.options.labelText,
95
94
  "class": "" + this.options.baseClass + "-label"
96
95
  });
97
- if (this.options.indeterminate) {
98
- this.$element.prop("indeterminate", true);
99
- }
100
96
  this.$element.on("init.bootstrapSwitch", (function(_this) {
101
97
  return function() {
102
98
  return _this.options.onInit.apply(element, arguments);
@@ -109,11 +105,24 @@
109
105
  })(this));
110
106
  this.$container = this.$element.wrap(this.$container).parent();
111
107
  this.$wrapper = this.$container.wrap(this.$wrapper).parent();
112
- this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off).trigger("init.bootstrapSwitch");
108
+ this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off);
109
+ if (this.options.indeterminate) {
110
+ this.$element.prop("indeterminate", true);
111
+ }
112
+ this._initWidth();
113
+ this._containerPosition(this.options.state, (function(_this) {
114
+ return function() {
115
+ if (_this.options.animate) {
116
+ return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
117
+ }
118
+ };
119
+ })(this));
113
120
  this._elementHandlers();
114
121
  this._handleHandlers();
115
122
  this._labelHandlers();
116
123
  this._formHandler();
124
+ this._externalLabelHandler();
125
+ this.$element.trigger("init.bootstrapSwitch");
117
126
  }
118
127
 
119
128
  BootstrapSwitch.prototype._constructor = BootstrapSwitch;
@@ -125,7 +134,7 @@
125
134
  if (this.options.disabled || this.options.readonly) {
126
135
  return this.$element;
127
136
  }
128
- if (this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) {
137
+ if (this.options.state && !this.options.radioAllOff && this.$element.is(":radio")) {
129
138
  return this.$element;
130
139
  }
131
140
  if (this.options.indeterminate) {
@@ -160,6 +169,7 @@
160
169
  if (value) {
161
170
  this.$wrapper.addClass("" + this.options.baseClass + "-" + value);
162
171
  }
172
+ this._width();
163
173
  this.options.size = value;
164
174
  return this.$element;
165
175
  };
@@ -169,14 +179,15 @@
169
179
  return this.options.animate;
170
180
  }
171
181
  value = !!value;
172
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-animate");
173
- this.options.animate = value;
174
- return this.$element;
182
+ if (value === this.options.animate) {
183
+ return this.$element;
184
+ }
185
+ return this.toggleAnimate();
175
186
  };
176
187
 
177
188
  BootstrapSwitch.prototype.toggleAnimate = function() {
178
- this.$wrapper.toggleClass("" + this.options.baseClass + "-animate");
179
189
  this.options.animate = !this.options.animate;
190
+ this.$wrapper.toggleClass("" + this.options.baseClass + "-animate");
180
191
  return this.$element;
181
192
  };
182
193
 
@@ -185,16 +196,16 @@
185
196
  return this.options.disabled;
186
197
  }
187
198
  value = !!value;
188
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-disabled");
189
- this.$element.prop("disabled", value);
190
- this.options.disabled = value;
191
- return this.$element;
199
+ if (value === this.options.disabled) {
200
+ return this.$element;
201
+ }
202
+ return this.toggleDisabled();
192
203
  };
193
204
 
194
205
  BootstrapSwitch.prototype.toggleDisabled = function() {
195
- this.$element.prop("disabled", !this.options.disabled);
196
- this.$wrapper.toggleClass("" + this.options.baseClass + "-disabled");
197
206
  this.options.disabled = !this.options.disabled;
207
+ this.$element.prop("disabled", this.options.disabled);
208
+ this.$wrapper.toggleClass("" + this.options.baseClass + "-disabled");
198
209
  return this.$element;
199
210
  };
200
211
 
@@ -203,16 +214,16 @@
203
214
  return this.options.readonly;
204
215
  }
205
216
  value = !!value;
206
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-readonly");
207
- this.$element.prop("readonly", value);
208
- this.options.readonly = value;
209
- return this.$element;
217
+ if (value === this.options.readonly) {
218
+ return this.$element;
219
+ }
220
+ return this.toggleReadonly();
210
221
  };
211
222
 
212
223
  BootstrapSwitch.prototype.toggleReadonly = function() {
213
- this.$element.prop("readonly", !this.options.readonly);
214
- this.$wrapper.toggleClass("" + this.options.baseClass + "-readonly");
215
224
  this.options.readonly = !this.options.readonly;
225
+ this.$element.prop("readonly", this.options.readonly);
226
+ this.$wrapper.toggleClass("" + this.options.baseClass + "-readonly");
216
227
  return this.$element;
217
228
  };
218
229
 
@@ -221,34 +232,29 @@
221
232
  return this.options.indeterminate;
222
233
  }
223
234
  value = !!value;
224
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-indeterminate");
225
- this.$element.prop("indeterminate", value);
226
- this.options.indeterminate = value;
227
- return this.$element;
235
+ if (value === this.options.indeterminate) {
236
+ return this.$element;
237
+ }
238
+ return this.toggleIndeterminate();
228
239
  };
229
240
 
230
241
  BootstrapSwitch.prototype.toggleIndeterminate = function() {
231
- this.$element.prop("indeterminate", !this.options.indeterminate);
232
- this.$wrapper.toggleClass("" + this.options.baseClass + "-indeterminate");
233
242
  this.options.indeterminate = !this.options.indeterminate;
243
+ this.$element.prop("indeterminate", this.options.indeterminate);
244
+ this.$wrapper.toggleClass("" + this.options.baseClass + "-indeterminate");
245
+ this._containerPosition();
234
246
  return this.$element;
235
247
  };
236
248
 
237
249
  BootstrapSwitch.prototype.inverse = function(value) {
238
- var $off, $on;
239
250
  if (typeof value === "undefined") {
240
251
  return this.options.inverse;
241
252
  }
242
253
  value = !!value;
243
- this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-inverse");
244
- $on = this.$on.clone(true);
245
- $off = this.$off.clone(true);
246
- this.$on.replaceWith($off);
247
- this.$off.replaceWith($on);
248
- this.$on = $off;
249
- this.$off = $on;
250
- this.options.inverse = value;
251
- return this.$element;
254
+ if (value === this.options.inverse) {
255
+ return this.$element;
256
+ }
257
+ return this.toggleInverse();
252
258
  };
253
259
 
254
260
  BootstrapSwitch.prototype.toggleInverse = function() {
@@ -297,6 +303,8 @@
297
303
  return this.options.onText;
298
304
  }
299
305
  this.$on.html(value);
306
+ this._width();
307
+ this._containerPosition();
300
308
  this.options.onText = value;
301
309
  return this.$element;
302
310
  };
@@ -306,6 +314,8 @@
306
314
  return this.options.offText;
307
315
  }
308
316
  this.$off.html(value);
317
+ this._width();
318
+ this._containerPosition();
309
319
  this.options.offText = value;
310
320
  return this.$element;
311
321
  };
@@ -315,10 +325,31 @@
315
325
  return this.options.labelText;
316
326
  }
317
327
  this.$label.html(value);
328
+ this._width();
318
329
  this.options.labelText = value;
319
330
  return this.$element;
320
331
  };
321
332
 
333
+ BootstrapSwitch.prototype.handleWidth = function(value) {
334
+ if (typeof value === "undefined") {
335
+ return this.options.handleWidth;
336
+ }
337
+ this.options.handleWidth = value;
338
+ this._width();
339
+ this._containerPosition();
340
+ return this.$element;
341
+ };
342
+
343
+ BootstrapSwitch.prototype.labelWidth = function(value) {
344
+ if (typeof value === "undefined") {
345
+ return this.options.labelWidth;
346
+ }
347
+ this.options.labelWidth = value;
348
+ this._width();
349
+ this._containerPosition();
350
+ return this.$element;
351
+ };
352
+
322
353
  BootstrapSwitch.prototype.baseClass = function(value) {
323
354
  return this.options.baseClass;
324
355
  };
@@ -340,6 +371,10 @@
340
371
  if (typeof value === "undefined") {
341
372
  return this.options.radioAllOff;
342
373
  }
374
+ value = !!value;
375
+ if (value === this.options.radioAllOff) {
376
+ return this.$element;
377
+ }
343
378
  this.options.radioAllOff = value;
344
379
  return this.$element;
345
380
  };
@@ -377,24 +412,100 @@
377
412
  return this.$element;
378
413
  };
379
414
 
415
+ BootstrapSwitch.prototype._width = function() {
416
+ var $handles, handleWidth;
417
+ $handles = this.$on.add(this.$off);
418
+ $handles.add(this.$label).css("width", "");
419
+ handleWidth = this.options.handleWidth === "auto" ? Math.max(this.$on.width(), this.$off.width()) : this.options.handleWidth;
420
+ $handles.width(handleWidth);
421
+ this.$label.width((function(_this) {
422
+ return function(index, width) {
423
+ if (_this.options.labelWidth !== "auto") {
424
+ return _this.options.labelWidth;
425
+ }
426
+ if (width < handleWidth) {
427
+ return handleWidth;
428
+ } else {
429
+ return width;
430
+ }
431
+ };
432
+ })(this));
433
+ this._handleWidth = this.$on.outerWidth();
434
+ this._labelWidth = this.$label.outerWidth();
435
+ this.$container.width((this._handleWidth * 2) + this._labelWidth);
436
+ return this.$wrapper.width(this._handleWidth + this._labelWidth);
437
+ };
438
+
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
+ BootstrapSwitch.prototype._containerPosition = function(state, callback) {
455
+ if (state == null) {
456
+ state = this.options.state;
457
+ }
458
+ this.$container.css("margin-left", (function(_this) {
459
+ return function() {
460
+ var values;
461
+ values = [0, "-" + _this._handleWidth + "px"];
462
+ if (_this.options.indeterminate) {
463
+ return "-" + (_this._handleWidth / 2) + "px";
464
+ }
465
+ if (state) {
466
+ if (_this.options.inverse) {
467
+ return values[1];
468
+ } else {
469
+ return values[0];
470
+ }
471
+ } else {
472
+ if (_this.options.inverse) {
473
+ return values[0];
474
+ } else {
475
+ return values[1];
476
+ }
477
+ }
478
+ };
479
+ })(this));
480
+ if (!callback) {
481
+ return;
482
+ }
483
+ if ($.support.transition) {
484
+ return this.$container.one("bsTransitionEnd", callback).emulateTransitionEnd(500);
485
+ } else {
486
+ return callback();
487
+ }
488
+ };
489
+
380
490
  BootstrapSwitch.prototype._elementHandlers = function() {
381
491
  return this.$element.on({
382
492
  "change.bootstrapSwitch": (function(_this) {
383
493
  return function(e, skip) {
384
- var checked;
494
+ var state;
385
495
  e.preventDefault();
386
496
  e.stopImmediatePropagation();
387
- checked = _this.$element.is(":checked");
388
- if (checked === _this.options.state) {
497
+ state = _this.$element.is(":checked");
498
+ _this._containerPosition(state);
499
+ if (state === _this.options.state) {
389
500
  return;
390
501
  }
391
- _this.options.state = checked;
392
- _this.$wrapper.removeClass(checked ? "" + _this.options.baseClass + "-off" : "" + _this.options.baseClass + "-on").addClass(checked ? "" + _this.options.baseClass + "-on" : "" + _this.options.baseClass + "-off");
502
+ _this.options.state = state;
503
+ _this.$wrapper.toggleClass("" + _this.options.baseClass + "-off").toggleClass("" + _this.options.baseClass + "-on");
393
504
  if (!skip) {
394
505
  if (_this.$element.is(":radio")) {
395
506
  $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true);
396
507
  }
397
- return _this.$element.trigger("switchChange.bootstrapSwitch", [checked]);
508
+ return _this.$element.trigger("switchChange.bootstrapSwitch", [state]);
398
509
  }
399
510
  };
400
511
  })(this),
@@ -447,59 +558,52 @@
447
558
 
448
559
  BootstrapSwitch.prototype._labelHandlers = function() {
449
560
  return this.$label.on({
450
- "mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) {
561
+ "mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) {
451
562
  return function(e) {
452
- var left, pageX, percent, right;
453
- if (!_this.isLabelDragging) {
563
+ if (_this._dragStart || _this.options.disabled || _this.options.readonly) {
454
564
  return;
455
565
  }
456
566
  e.preventDefault();
457
- _this.isLabelDragged = true;
458
- pageX = e.pageX || e.originalEvent.touches[0].pageX;
459
- percent = ((pageX - _this.$wrapper.offset().left) / _this.$wrapper.width()) * 100;
460
- left = 25;
461
- right = 75;
567
+ _this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css("margin-left"), 10);
462
568
  if (_this.options.animate) {
463
569
  _this.$wrapper.removeClass("" + _this.options.baseClass + "-animate");
464
570
  }
465
- if (percent < left) {
466
- percent = left;
467
- } else if (percent > right) {
468
- percent = right;
469
- }
470
- _this.$container.css("margin-left", "" + (percent - right) + "%");
471
571
  return _this.$element.trigger("focus.bootstrapSwitch");
472
572
  };
473
573
  })(this),
474
- "mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) {
574
+ "mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) {
475
575
  return function(e) {
476
- if (_this.isLabelDragging || _this.options.disabled || _this.options.readonly) {
576
+ var difference;
577
+ if (_this._dragStart == null) {
477
578
  return;
478
579
  }
479
580
  e.preventDefault();
480
- _this.isLabelDragging = true;
481
- return _this.$element.trigger("focus.bootstrapSwitch");
581
+ difference = (e.pageX || e.originalEvent.touches[0].pageX) - _this._dragStart;
582
+ if (difference < -_this._handleWidth || difference > 0) {
583
+ return;
584
+ }
585
+ _this._dragEnd = difference;
586
+ return _this.$container.css("margin-left", "" + _this._dragEnd + "px");
482
587
  };
483
588
  })(this),
484
589
  "mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) {
485
590
  return function(e) {
486
591
  var state;
487
- if (!_this.isLabelDragging) {
592
+ if (!_this._dragStart) {
488
593
  return;
489
594
  }
490
595
  e.preventDefault();
491
- if (_this.isLabelDragged) {
492
- state = parseInt(_this.$container.css("margin-left"), 10) > -(_this.$container.width() / 6);
493
- _this.isLabelDragged = false;
596
+ if (_this.options.animate) {
597
+ _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
598
+ }
599
+ if (_this._dragEnd) {
600
+ state = _this._dragEnd > -(_this._handleWidth / 2);
601
+ _this._dragEnd = false;
494
602
  _this.state(_this.options.inverse ? !state : state);
495
- if (_this.options.animate) {
496
- _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
497
- }
498
- _this.$container.css("margin-left", "");
499
603
  } else {
500
604
  _this.state(!_this.options.state);
501
605
  }
502
- return _this.isLabelDragging = false;
606
+ return _this._dragStart = false;
503
607
  };
504
608
  })(this),
505
609
  "mouseleave.bootstrapSwitch": (function(_this) {
@@ -510,6 +614,20 @@
510
614
  });
511
615
  };
512
616
 
617
+ BootstrapSwitch.prototype._externalLabelHandler = function() {
618
+ var $externalLabel;
619
+ $externalLabel = this.$element.closest("label");
620
+ return $externalLabel.on("click", (function(_this) {
621
+ return function(event) {
622
+ event.preventDefault();
623
+ event.stopImmediatePropagation();
624
+ if (event.target === $externalLabel[0]) {
625
+ return _this.toggleState();
626
+ }
627
+ };
628
+ })(this));
629
+ };
630
+
513
631
  BootstrapSwitch.prototype._formHandler = function() {
514
632
  var $form;
515
633
  $form = this.$element.closest("form");
@@ -575,6 +693,8 @@
575
693
  onText: "ON",
576
694
  offText: "OFF",
577
695
  labelText: "&nbsp;",
696
+ handleWidth: "auto",
697
+ labelWidth: "auto",
578
698
  baseClass: "bootstrap-switch",
579
699
  wrapperClass: "wrapper",
580
700
  onInit: function() {},
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v3.1.0
2
+ * bootstrap-switch - v3.2.2
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v3.1.0
2
+ * bootstrap-switch - v3.2.2
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -34,108 +34,11 @@
34
34
  -ms-user-select: none;
35
35
  user-select: none;
36
36
  vertical-align: middle;
37
- min-width: 100px;
38
37
  -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
39
38
  transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
40
39
  }
41
- .bootstrap-switch.bootstrap-switch-mini {
42
- min-width: 71px;
43
- }
44
- .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,
45
- .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,
46
- .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label {
47
- padding-bottom: 4px;
48
- padding-top: 4px;
49
- font-size: 10px;
50
- line-height: 9px;
51
- }
52
- .bootstrap-switch.bootstrap-switch-small {
53
- min-width: 79px;
54
- }
55
- .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,
56
- .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,
57
- .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label {
58
- padding-bottom: 3px;
59
- padding-top: 3px;
60
- font-size: 12px;
61
- line-height: 18px;
62
- }
63
- .bootstrap-switch.bootstrap-switch-large {
64
- min-width: 120px;
65
- }
66
- .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,
67
- .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,
68
- .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label {
69
- padding-bottom: 9px;
70
- padding-top: 9px;
71
- font-size: 16px;
72
- line-height: normal;
73
- }
74
- .bootstrap-switch.bootstrap-switch-disabled,
75
- .bootstrap-switch.bootstrap-switch-readonly,
76
- .bootstrap-switch.bootstrap-switch-indeterminate {
77
- opacity: 0.5;
78
- filter: alpha(opacity=50);
79
- cursor: default !important;
80
- }
81
- .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,
82
- .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,
83
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,
84
- .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,
85
- .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,
86
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,
87
- .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,
88
- .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label,
89
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label {
90
- cursor: default !important;
91
- }
92
- .bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {
93
- -webkit-transition: margin-left 0.5s;
94
- transition: margin-left 0.5s;
95
- }
96
- .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {
97
- border-bottom-left-radius: 0;
98
- border-top-left-radius: 0;
99
- border-bottom-right-radius: 3px;
100
- border-top-right-radius: 3px;
101
- }
102
- .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off {
103
- border-bottom-right-radius: 0;
104
- border-top-right-radius: 0;
105
- border-bottom-left-radius: 3px;
106
- border-top-left-radius: 3px;
107
- }
108
- .bootstrap-switch.bootstrap-switch-focused {
109
- border-color: #66afe9;
110
- outline: 0;
111
- -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
112
- box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
113
- }
114
- .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-container,
115
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-container {
116
- margin-left: 0%;
117
- }
118
- .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label,
119
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label {
120
- border-bottom-right-radius: 3px;
121
- border-top-right-radius: 3px;
122
- }
123
- .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-container,
124
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-container {
125
- margin-left: -50%;
126
- }
127
- .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label,
128
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label {
129
- border-bottom-left-radius: 3px;
130
- border-top-left-radius: 3px;
131
- }
132
- .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-container,
133
- .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-indeterminate .bootstrap-switch-container {
134
- margin-left: -25%;
135
- }
136
40
  .bootstrap-switch .bootstrap-switch-container {
137
41
  display: inline-block;
138
- width: 150%;
139
42
  top: 0;
140
43
  border-radius: 4px;
141
44
  -webkit-transform: translate3d(0, 0, 0);
@@ -150,8 +53,7 @@
150
53
  cursor: pointer;
151
54
  display: inline-block !important;
152
55
  height: 100%;
153
- padding-bottom: 4px;
154
- padding-top: 4px;
56
+ padding: 6px 12px;
155
57
  font-size: 14px;
156
58
  line-height: 20px;
157
59
  }
@@ -159,7 +61,6 @@
159
61
  .bootstrap-switch .bootstrap-switch-handle-off {
160
62
  text-align: center;
161
63
  z-index: 1;
162
- width: 33.333333333%;
163
64
  }
164
65
  .bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary,
165
66
  .bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary {
@@ -196,7 +97,6 @@
196
97
  margin-top: -1px;
197
98
  margin-bottom: -1px;
198
99
  z-index: 100;
199
- width: 33.333333333%;
200
100
  color: #333333;
201
101
  background: #ffffff;
202
102
  }
@@ -221,3 +121,74 @@
221
121
  .bootstrap-switch input[type='checkbox'].form-control {
222
122
  height: auto;
223
123
  }
124
+ .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,
125
+ .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,
126
+ .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label {
127
+ padding: 1px 5px;
128
+ font-size: 12px;
129
+ line-height: 1.5;
130
+ }
131
+ .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,
132
+ .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,
133
+ .bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label {
134
+ padding: 5px 10px;
135
+ font-size: 12px;
136
+ line-height: 1.5;
137
+ }
138
+ .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,
139
+ .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,
140
+ .bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label {
141
+ padding: 6px 16px;
142
+ font-size: 18px;
143
+ line-height: 1.33;
144
+ }
145
+ .bootstrap-switch.bootstrap-switch-disabled,
146
+ .bootstrap-switch.bootstrap-switch-readonly,
147
+ .bootstrap-switch.bootstrap-switch-indeterminate {
148
+ cursor: default !important;
149
+ }
150
+ .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,
151
+ .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,
152
+ .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,
153
+ .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,
154
+ .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,
155
+ .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,
156
+ .bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,
157
+ .bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label,
158
+ .bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label {
159
+ opacity: 0.5;
160
+ filter: alpha(opacity=50);
161
+ cursor: default !important;
162
+ }
163
+ .bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {
164
+ -webkit-transition: margin-left 0.5s;
165
+ transition: margin-left 0.5s;
166
+ }
167
+ .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {
168
+ border-bottom-left-radius: 0;
169
+ border-top-left-radius: 0;
170
+ border-bottom-right-radius: 3px;
171
+ border-top-right-radius: 3px;
172
+ }
173
+ .bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off {
174
+ border-bottom-right-radius: 0;
175
+ border-top-right-radius: 0;
176
+ border-bottom-left-radius: 3px;
177
+ border-top-left-radius: 3px;
178
+ }
179
+ .bootstrap-switch.bootstrap-switch-focused {
180
+ border-color: #66afe9;
181
+ outline: 0;
182
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
183
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
184
+ }
185
+ .bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label,
186
+ .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label {
187
+ border-bottom-right-radius: 3px;
188
+ border-top-right-radius: 3px;
189
+ }
190
+ .bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label,
191
+ .bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label {
192
+ border-bottom-left-radius: 3px;
193
+ border-top-left-radius: 3px;
194
+ }
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.1.0
4
+ version: 3.2.2
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-10-27 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler