Skip to content

Commit

Permalink
updated assets to 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel van Rijn committed Jan 27, 2014
1 parent 56ec24a commit b6a0891
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 111 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ See the [demo page of Mattia Larentis](http://www.bootstrap-switch.org/) for exa

| Version | Notes |
| -------:| ----------------------------------------------------------------------------------- |
| 2.0.1 | Update to v2.0.1 of the bootstrap-switch plugin |
| 2.0.0 | Update to v2.0 of the bootstrap-switch plugin |
| 1.9.0 | Update to v1.9 of the bootstrap-switch plugin |
| 1.8.0 | Update to v1.8 of the bootstrap-switch plugin |
Expand Down
2 changes: 1 addition & 1 deletion lib/bootstrap-switch-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Bootstrap
module Switch
module Rails
VERSION = "2.0.0"
VERSION = "2.0.1"
end
end
end
62 changes: 25 additions & 37 deletions vendor/assets/javascripts/bootstrap-switch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ========================================================================
* bootstrap-switch - v2.0.0
* bootstrap-switch - v2.0.1
* http://www.bootstrap-switch.org
* ========================================================================
* Copyright 2012-2013 Mattia Larentis
Expand Down Expand Up @@ -81,29 +81,27 @@
return $label.trigger("mousedown").trigger("mouseup").trigger("click");
};
$element.data("bootstrap-switch", true);
if ($element.attr("class")) {
$.each(["switch-mini", "switch-small", "switch-large"], function(i, cls) {
if ($element.attr("class").indexOf(cls) >= 0) {
$switchLeft.addClass(cls);
$label.addClass(cls);
return $switchRight.addClass(cls);
}
});
}
if ($element.data("on") != null) {
$switchLeft.addClass("switch-" + $element.data("on"));
}
if ($element.data("off") != null) {
$switchRight.addClass("switch-" + $element.data("off"));
}
$div.data("animated", false);
$wrapper.data("animated", false);
if ($element.data("animated") !== false) {
$div.addClass("switch-animate").data("animated", true);
$wrapper.addClass("switch-animate").data("animated", true);
}
$div = $element.wrap($div).parent();
$wrapper = $div.wrap($wrapper).parent();
if ($element.attr("class")) {
$.each(["switch-mini", "switch-small", "switch-large"], function(i, cls) {
if ($element.attr("class").indexOf(cls) >= 0) {
return $wrapper.addClass(cls);
}
});
}
$element.before($switchLeft).before($label).before($switchRight);
$div.addClass($element.is(":checked") ? "switch-on" : "switch-off");
$wrapper.addClass($element.is(":checked") ? "switch-on" : "switch-off");
if ($element.is(":disabled") || $element.is("[readonly]")) {
$wrapper.addClass("disabled");
}
Expand All @@ -117,19 +115,19 @@
}).on("change", function(e, skip) {
var isChecked, state;
isChecked = $element.is(":checked");
state = $div.hasClass("switch-off");
state = $wrapper.hasClass("switch-off");
e.preventDefault();
$div.css("left", "");
if (state !== isChecked) {
return;
}
if (isChecked) {
$div.removeClass("switch-off").addClass("switch-on");
$wrapper.removeClass("switch-off").addClass("switch-on");
} else {
$div.removeClass("switch-on").addClass("switch-off");
$wrapper.removeClass("switch-on").addClass("switch-off");
}
if ($div.data("animated") !== false) {
$div.addClass("switch-animate");
if ($wrapper.data("animated") !== false) {
$wrapper.addClass("switch-animate");
}
if (typeof skip === "boolean" && skip) {
return;
Expand Down Expand Up @@ -171,7 +169,7 @@
moving = false;
e.preventDefault();
e.stopImmediatePropagation();
$div.removeClass("switch-animate");
$wrapper.removeClass("switch-animate");
if ($element.is(":disabled") || $element.is("[readonly]") || $element.hasClass("radio-no-uncheck")) {
return $label.unbind("click");
}
Expand Down Expand Up @@ -336,31 +334,21 @@
return $element;
},
setAnimated: function(value) {
var $div, $element;
var $element, $wrapper;
$element = $(this);
$div = $element.parent();
$wrapper = $element.parents(".has-switch");
if (value == null) {
value = false;
}
$div.data("animated", value).attr("data-animated", value)[$div.data("animated") !== false ? "addClass" : "removeClass"]("switch-animate");
$wrapper.data("animated", value).attr("data-animated", value)[$wrapper.data("animated") !== false ? "addClass" : "removeClass"]("switch-animate");
return $element;
},
setSizeClass: function(value) {
var $element, $label, $switchLeft, $switchRight;
var $element, $wrapper;
$element = $(this);
$switchLeft = $element.siblings(".switch-left");
$label = $element.siblings("label");
$switchRight = $element.siblings(".switch-right");
$wrapper = $element.parents(".has-switch");
$.each(["switch-mini", "switch-small", "switch-large"], function(i, cls) {
if (cls !== value) {
$switchLeft.removeClass(cls);
$label.removeClass(cls);
return $switchRight.removeClass(cls);
} else {
$switchLeft.addClass(cls);
$label.addClass(cls);
return $switchRight.addClass(cls);
}
return $wrapper[cls !== value ? "removeClass" : "addClass"](cls);
});
return $element;
},
Expand All @@ -385,9 +373,9 @@
$div = $element.parent();
$form = $div.closest("form");
$div.children().not($element).remove();
$element.unwrap().unwrap().unbind("change");
$element.unwrap().unwrap().off("change");
if ($form.length) {
$form.unbind("reset").removeData("bootstrapSwitch");
$form.off("reset").removeData("bootstrap-switch");
}
return $element;
}
Expand Down
81 changes: 44 additions & 37 deletions vendor/assets/stylesheets/bootstrap2-switch.css.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ========================================================================
* bootstrap-switch - v2.0.0
* bootstrap-switch - v2.0.1
* http://www.bootstrap-switch.org
* ========================================================================
* Copyright 2012-2013 Mattia Larentis
Expand Down Expand Up @@ -73,6 +73,13 @@
.has-switch.switch-mini {
min-width: 72px;
}
.has-switch.switch-mini span,
.has-switch.switch-mini label {
padding-bottom: 4px;
padding-top: 4px;
font-size: 10px;
line-height: 9px;
}
.has-switch.switch-mini i.switch-mini-icons {
height: 1.20em;
line-height: 9px;
Expand All @@ -85,36 +92,57 @@
.has-switch.switch-small {
min-width: 80px;
}
.has-switch.switch-small span,
.has-switch.switch-small label {
padding-bottom: 3px;
padding-top: 3px;
font-size: 12px;
line-height: 18px;
}
.has-switch.switch-large {
min-width: 120px;
}
.has-switch.switch-large span,
.has-switch.switch-large label {
padding-bottom: 9px;
padding-top: 9px;
font-size: 16px;
line-height: normal;
}
.has-switch.switch-animate > div {
-webkit-transition: left 0.5s;
-moz-transition: left 0.5s;
-o-transition: left 0.5s;
transition: left 0.5s;
}
.has-switch.switch-off > div {
left: -50%;
}
.has-switch.switch-on > div {
left: 0%;
}
.has-switch.disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default !important;
}
.has-switch.disabled label,
.has-switch.disabled span {
.has-switch.disabled span,
.has-switch.disabled label {
cursor: default !important;
}
.has-switch:focus {
border-color: #0088cc;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(red(@btnPrimaryBackground), green(@btnPrimaryBackground), blue(@btnPrimaryBackground), .6);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(red(@btnPrimaryBackground), green(@btnPrimaryBackground), blue(@btnPrimaryBackground), .6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(red(@btnPrimaryBackground), green(@btnPrimaryBackground), blue(@btnPrimaryBackground), .6);
}
.has-switch > div {
display: inline-block;
width: 150%;
position: relative;
top: 0;
}
.has-switch > div.switch-animate {
-webkit-transition: left 0.5s;
-moz-transition: left 0.5s;
-o-transition: left 0.5s;
transition: left 0.5s;
}
.has-switch > div.switch-off {
left: -50%;
}
.has-switch > div.switch-on {
left: 0%;
}
.has-switch input[type=radio],
.has-switch input[type=checkbox] {
display: none;
Expand All @@ -126,34 +154,13 @@
box-sizing: border-box;
cursor: pointer;
position: relative;
display: inline-block;
display: inline-block !important;
height: 100%;
padding-bottom: 4px;
padding-top: 4px;
font-size: 14px;
line-height: 20px;
}
.has-switch span.switch-mini,
.has-switch label.switch-mini {
padding-bottom: 4px;
padding-top: 4px;
font-size: 10px;
line-height: 9px;
}
.has-switch span.switch-small,
.has-switch label.switch-small {
padding-bottom: 3px;
padding-top: 3px;
font-size: 12px;
line-height: 18px;
}
.has-switch span.switch-large,
.has-switch label.switch-large {
padding-bottom: 9px;
padding-top: 9px;
font-size: 16px;
line-height: normal;
}
.has-switch label {
text-align: center;
margin-top: -1px;
Expand Down
Loading

0 comments on commit b6a0891

Please sign in to comment.