bootstrap-switch-rails 2.0.0 → 2.0.1

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: 21af23c54fb89d9c6d5d7321d46b8118cc816c9d
4
- data.tar.gz: 35b58817fb97f0aa510353d9cacf95edfdcf3ac8
3
+ metadata.gz: 5ec5da0a84de707a54c4f674226f91c205aec8c4
4
+ data.tar.gz: 04349d34b807309a7af6dc15ab891c0eee07c3dc
5
5
  SHA512:
6
- metadata.gz: 0fd9bf8eaf95987046b6d9ed44c01e2737bd8216f9e37bd807362a39a79a2c5394294c4b5a33503da4db05ef7999af4bbf33f25fa6cbca94bb86e1e7ef50cbc8
7
- data.tar.gz: dcfac29a9fea99800b55d7f6d20a8693ce8c1852a16704e0a0ec44bfdac931872fde672baaf83dee0cc6e119f08def69ee760181c6abb987c87e7323b7a10f8b
6
+ metadata.gz: 34d19302f3432f51cd829956a2186cf708404ec00d90cd9b99301c2ec94512263e51a072ec805350bc4d1b44593718df6d03c6c65c0eb9f7e520b612f8163206
7
+ data.tar.gz: be8cbbc0cf9506cdf25b85bcf425d75cfde5726e837519f4813fde2f6869eb71e350ecd8e83574984773ef682324a813462ab2e9c8ee1c2534e1d5a282bee9f3
data/README.md CHANGED
@@ -52,6 +52,7 @@ See the [demo page of Mattia Larentis](http://www.bootstrap-switch.org/) for exa
52
52
 
53
53
  | Version | Notes |
54
54
  | -------:| ----------------------------------------------------------------------------------- |
55
+ | 2.0.1 | Update to v2.0.1 of the bootstrap-switch plugin |
55
56
  | 2.0.0 | Update to v2.0 of the bootstrap-switch plugin |
56
57
  | 1.9.0 | Update to v1.9 of the bootstrap-switch plugin |
57
58
  | 1.8.0 | Update to v1.8 of the bootstrap-switch plugin |
@@ -1,7 +1,7 @@
1
1
  module Bootstrap
2
2
  module Switch
3
3
  module Rails
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v2.0.0
2
+ * bootstrap-switch - v2.0.1
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -81,29 +81,27 @@
81
81
  return $label.trigger("mousedown").trigger("mouseup").trigger("click");
82
82
  };
83
83
  $element.data("bootstrap-switch", true);
84
- if ($element.attr("class")) {
85
- $.each(["switch-mini", "switch-small", "switch-large"], function(i, cls) {
86
- if ($element.attr("class").indexOf(cls) >= 0) {
87
- $switchLeft.addClass(cls);
88
- $label.addClass(cls);
89
- return $switchRight.addClass(cls);
90
- }
91
- });
92
- }
93
84
  if ($element.data("on") != null) {
94
85
  $switchLeft.addClass("switch-" + $element.data("on"));
95
86
  }
96
87
  if ($element.data("off") != null) {
97
88
  $switchRight.addClass("switch-" + $element.data("off"));
98
89
  }
99
- $div.data("animated", false);
90
+ $wrapper.data("animated", false);
100
91
  if ($element.data("animated") !== false) {
101
- $div.addClass("switch-animate").data("animated", true);
92
+ $wrapper.addClass("switch-animate").data("animated", true);
102
93
  }
103
94
  $div = $element.wrap($div).parent();
104
95
  $wrapper = $div.wrap($wrapper).parent();
96
+ if ($element.attr("class")) {
97
+ $.each(["switch-mini", "switch-small", "switch-large"], function(i, cls) {
98
+ if ($element.attr("class").indexOf(cls) >= 0) {
99
+ return $wrapper.addClass(cls);
100
+ }
101
+ });
102
+ }
105
103
  $element.before($switchLeft).before($label).before($switchRight);
106
- $div.addClass($element.is(":checked") ? "switch-on" : "switch-off");
104
+ $wrapper.addClass($element.is(":checked") ? "switch-on" : "switch-off");
107
105
  if ($element.is(":disabled") || $element.is("[readonly]")) {
108
106
  $wrapper.addClass("disabled");
109
107
  }
@@ -117,19 +115,19 @@
117
115
  }).on("change", function(e, skip) {
118
116
  var isChecked, state;
119
117
  isChecked = $element.is(":checked");
120
- state = $div.hasClass("switch-off");
118
+ state = $wrapper.hasClass("switch-off");
121
119
  e.preventDefault();
122
120
  $div.css("left", "");
123
121
  if (state !== isChecked) {
124
122
  return;
125
123
  }
126
124
  if (isChecked) {
127
- $div.removeClass("switch-off").addClass("switch-on");
125
+ $wrapper.removeClass("switch-off").addClass("switch-on");
128
126
  } else {
129
- $div.removeClass("switch-on").addClass("switch-off");
127
+ $wrapper.removeClass("switch-on").addClass("switch-off");
130
128
  }
131
- if ($div.data("animated") !== false) {
132
- $div.addClass("switch-animate");
129
+ if ($wrapper.data("animated") !== false) {
130
+ $wrapper.addClass("switch-animate");
133
131
  }
134
132
  if (typeof skip === "boolean" && skip) {
135
133
  return;
@@ -171,7 +169,7 @@
171
169
  moving = false;
172
170
  e.preventDefault();
173
171
  e.stopImmediatePropagation();
174
- $div.removeClass("switch-animate");
172
+ $wrapper.removeClass("switch-animate");
175
173
  if ($element.is(":disabled") || $element.is("[readonly]") || $element.hasClass("radio-no-uncheck")) {
176
174
  return $label.unbind("click");
177
175
  }
@@ -336,31 +334,21 @@
336
334
  return $element;
337
335
  },
338
336
  setAnimated: function(value) {
339
- var $div, $element;
337
+ var $element, $wrapper;
340
338
  $element = $(this);
341
- $div = $element.parent();
339
+ $wrapper = $element.parents(".has-switch");
342
340
  if (value == null) {
343
341
  value = false;
344
342
  }
345
- $div.data("animated", value).attr("data-animated", value)[$div.data("animated") !== false ? "addClass" : "removeClass"]("switch-animate");
343
+ $wrapper.data("animated", value).attr("data-animated", value)[$wrapper.data("animated") !== false ? "addClass" : "removeClass"]("switch-animate");
346
344
  return $element;
347
345
  },
348
346
  setSizeClass: function(value) {
349
- var $element, $label, $switchLeft, $switchRight;
347
+ var $element, $wrapper;
350
348
  $element = $(this);
351
- $switchLeft = $element.siblings(".switch-left");
352
- $label = $element.siblings("label");
353
- $switchRight = $element.siblings(".switch-right");
349
+ $wrapper = $element.parents(".has-switch");
354
350
  $.each(["switch-mini", "switch-small", "switch-large"], function(i, cls) {
355
- if (cls !== value) {
356
- $switchLeft.removeClass(cls);
357
- $label.removeClass(cls);
358
- return $switchRight.removeClass(cls);
359
- } else {
360
- $switchLeft.addClass(cls);
361
- $label.addClass(cls);
362
- return $switchRight.addClass(cls);
363
- }
351
+ return $wrapper[cls !== value ? "removeClass" : "addClass"](cls);
364
352
  });
365
353
  return $element;
366
354
  },
@@ -385,9 +373,9 @@
385
373
  $div = $element.parent();
386
374
  $form = $div.closest("form");
387
375
  $div.children().not($element).remove();
388
- $element.unwrap().unwrap().unbind("change");
376
+ $element.unwrap().unwrap().off("change");
389
377
  if ($form.length) {
390
- $form.unbind("reset").removeData("bootstrapSwitch");
378
+ $form.off("reset").removeData("bootstrap-switch");
391
379
  }
392
380
  return $element;
393
381
  }
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v2.0.0
2
+ * bootstrap-switch - v2.0.1
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -73,6 +73,13 @@
73
73
  .has-switch.switch-mini {
74
74
  min-width: 72px;
75
75
  }
76
+ .has-switch.switch-mini span,
77
+ .has-switch.switch-mini label {
78
+ padding-bottom: 4px;
79
+ padding-top: 4px;
80
+ font-size: 10px;
81
+ line-height: 9px;
82
+ }
76
83
  .has-switch.switch-mini i.switch-mini-icons {
77
84
  height: 1.20em;
78
85
  line-height: 9px;
@@ -85,36 +92,57 @@
85
92
  .has-switch.switch-small {
86
93
  min-width: 80px;
87
94
  }
95
+ .has-switch.switch-small span,
96
+ .has-switch.switch-small label {
97
+ padding-bottom: 3px;
98
+ padding-top: 3px;
99
+ font-size: 12px;
100
+ line-height: 18px;
101
+ }
88
102
  .has-switch.switch-large {
89
103
  min-width: 120px;
90
104
  }
105
+ .has-switch.switch-large span,
106
+ .has-switch.switch-large label {
107
+ padding-bottom: 9px;
108
+ padding-top: 9px;
109
+ font-size: 16px;
110
+ line-height: normal;
111
+ }
112
+ .has-switch.switch-animate > div {
113
+ -webkit-transition: left 0.5s;
114
+ -moz-transition: left 0.5s;
115
+ -o-transition: left 0.5s;
116
+ transition: left 0.5s;
117
+ }
118
+ .has-switch.switch-off > div {
119
+ left: -50%;
120
+ }
121
+ .has-switch.switch-on > div {
122
+ left: 0%;
123
+ }
91
124
  .has-switch.disabled {
92
125
  opacity: 0.5;
93
126
  filter: alpha(opacity=50);
94
127
  cursor: default !important;
95
128
  }
96
- .has-switch.disabled label,
97
- .has-switch.disabled span {
129
+ .has-switch.disabled span,
130
+ .has-switch.disabled label {
98
131
  cursor: default !important;
99
132
  }
133
+ .has-switch:focus {
134
+ border-color: #0088cc;
135
+ outline: 0;
136
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(red(@btnPrimaryBackground), green(@btnPrimaryBackground), blue(@btnPrimaryBackground), .6);
137
+ -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(red(@btnPrimaryBackground), green(@btnPrimaryBackground), blue(@btnPrimaryBackground), .6);
138
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(red(@btnPrimaryBackground), green(@btnPrimaryBackground), blue(@btnPrimaryBackground), .6);
139
+ }
100
140
  .has-switch > div {
101
141
  display: inline-block;
102
142
  width: 150%;
103
143
  position: relative;
104
144
  top: 0;
105
145
  }
106
- .has-switch > div.switch-animate {
107
- -webkit-transition: left 0.5s;
108
- -moz-transition: left 0.5s;
109
- -o-transition: left 0.5s;
110
- transition: left 0.5s;
111
- }
112
- .has-switch > div.switch-off {
113
- left: -50%;
114
- }
115
- .has-switch > div.switch-on {
116
- left: 0%;
117
- }
118
146
  .has-switch input[type=radio],
119
147
  .has-switch input[type=checkbox] {
120
148
  display: none;
@@ -126,34 +154,13 @@
126
154
  box-sizing: border-box;
127
155
  cursor: pointer;
128
156
  position: relative;
129
- display: inline-block;
157
+ display: inline-block !important;
130
158
  height: 100%;
131
159
  padding-bottom: 4px;
132
160
  padding-top: 4px;
133
161
  font-size: 14px;
134
162
  line-height: 20px;
135
163
  }
136
- .has-switch span.switch-mini,
137
- .has-switch label.switch-mini {
138
- padding-bottom: 4px;
139
- padding-top: 4px;
140
- font-size: 10px;
141
- line-height: 9px;
142
- }
143
- .has-switch span.switch-small,
144
- .has-switch label.switch-small {
145
- padding-bottom: 3px;
146
- padding-top: 3px;
147
- font-size: 12px;
148
- line-height: 18px;
149
- }
150
- .has-switch span.switch-large,
151
- .has-switch label.switch-large {
152
- padding-bottom: 9px;
153
- padding-top: 9px;
154
- font-size: 16px;
155
- line-height: normal;
156
- }
157
164
  .has-switch label {
158
165
  text-align: center;
159
166
  margin-top: -1px;
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * bootstrap-switch - v2.0.0
2
+ * bootstrap-switch - v2.0.1
3
3
  * http://www.bootstrap-switch.org
4
4
  * ========================================================================
5
5
  * Copyright 2012-2013 Mattia Larentis
@@ -48,6 +48,13 @@
48
48
  .has-switch.switch-mini {
49
49
  min-width: 72px;
50
50
  }
51
+ .has-switch.switch-mini span,
52
+ .has-switch.switch-mini label {
53
+ padding-bottom: 4px;
54
+ padding-top: 4px;
55
+ font-size: 10px;
56
+ line-height: 9px;
57
+ }
51
58
  .has-switch.switch-mini i.switch-mini-icons {
52
59
  height: 1.20em;
53
60
  line-height: 9px;
@@ -60,16 +67,40 @@
60
67
  .has-switch.switch-small {
61
68
  min-width: 80px;
62
69
  }
70
+ .has-switch.switch-small span,
71
+ .has-switch.switch-small label {
72
+ padding-bottom: 3px;
73
+ padding-top: 3px;
74
+ font-size: 12px;
75
+ line-height: 18px;
76
+ }
63
77
  .has-switch.switch-large {
64
78
  min-width: 120px;
65
79
  }
80
+ .has-switch.switch-large span,
81
+ .has-switch.switch-large label {
82
+ padding-bottom: 9px;
83
+ padding-top: 9px;
84
+ font-size: 16px;
85
+ line-height: normal;
86
+ }
87
+ .has-switch.switch-animate > div {
88
+ -webkit-transition: left 0.5s;
89
+ transition: left 0.5s;
90
+ }
91
+ .has-switch.switch-off > div {
92
+ left: -50%;
93
+ }
94
+ .has-switch.switch-on > div {
95
+ left: 0%;
96
+ }
66
97
  .has-switch.disabled {
67
98
  opacity: 0.5;
68
99
  filter: alpha(opacity=50);
69
100
  cursor: default !important;
70
101
  }
71
- .has-switch.disabled label,
72
- .has-switch.disabled span {
102
+ .has-switch.disabled span,
103
+ .has-switch.disabled label {
73
104
  cursor: default !important;
74
105
  }
75
106
  .has-switch > div {
@@ -77,16 +108,8 @@
77
108
  width: 150%;
78
109
  position: relative;
79
110
  top: 0;
80
- }
81
- .has-switch > div.switch-animate {
82
- -webkit-transition: left 0.5s;
83
- transition: left 0.5s;
84
- }
85
- .has-switch > div.switch-off {
86
- left: -50%;
87
- }
88
- .has-switch > div.switch-on {
89
- left: 0%;
111
+ -webkit-transform: translate3d(0, 0, 0);
112
+ transform: translate3d(0, 0, 0);
90
113
  }
91
114
  .has-switch input[type=radio],
92
115
  .has-switch input[type=checkbox] {
@@ -106,33 +129,12 @@
106
129
  font-size: 14px;
107
130
  line-height: 20px;
108
131
  }
109
- .has-switch span.switch-mini,
110
- .has-switch label.switch-mini {
111
- padding-bottom: 4px;
112
- padding-top: 4px;
113
- font-size: 10px;
114
- line-height: 9px;
115
- }
116
- .has-switch span.switch-small,
117
- .has-switch label.switch-small {
118
- padding-bottom: 3px;
119
- padding-top: 3px;
120
- font-size: 12px;
121
- line-height: 18px;
122
- }
123
- .has-switch span.switch-large,
124
- .has-switch label.switch-large {
125
- padding-bottom: 9px;
126
- padding-top: 9px;
127
- font-size: 16px;
128
- line-height: normal;
129
- }
130
132
  .has-switch label {
131
133
  text-align: center;
132
134
  margin-top: -1px;
133
135
  margin-bottom: -1px;
134
136
  z-index: 100;
135
- width: 34%;
137
+ width: 33.333333333%;
136
138
  background: #ffffff;
137
139
  }
138
140
  .has-switch label i {
@@ -144,7 +146,7 @@
144
146
  .has-switch span {
145
147
  text-align: center;
146
148
  z-index: 1;
147
- width: 33%;
149
+ width: 33.333333333%;
148
150
  }
149
151
  .has-switch span.switch-left {
150
152
  color: #f00;
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: 2.0.0
4
+ version: 2.0.1
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: 2013-12-30 00:00:00.000000000 Z
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler