Skip to content

Commit

Permalink
updated assets to v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelvanrijn committed Oct 27, 2014
1 parent 5b16f4a commit 453e74f
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 89 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 |
| -------:| ----------------------------------------------------------------------------------- |
| 3.1.2 | Update to v3.1.2 of the bootstrap-switch plugin |
| 3.0.2 | Update to v3.0.2 of the bootstrap-switch plugin |
| 3.0.0 | Update to v3.0.0 of the bootstrap-switch plugin |
| 2.0.2 | Fixed issue where bootstrap 2 sass wasn't compiling (issue #7) |
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 = "3.0.2"
VERSION = "3.1.0"
end
end
end
77 changes: 65 additions & 12 deletions vendor/assets/javascripts/bootstrap-switch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ========================================================================
* bootstrap-switch - v3.0.2
* bootstrap-switch - v3.1.0
* http://www.bootstrap-switch.org
* ========================================================================
* Copyright 2012-2013 Mattia Larentis
Expand Down Expand Up @@ -38,14 +38,15 @@
disabled: this.$element.is(":disabled"),
readonly: this.$element.is("[readonly]"),
indeterminate: this.$element.data("indeterminate"),
inverse: this.$element.data("inverse"),
radioAllOff: this.$element.data("radio-all-off"),
onColor: this.$element.data("on-color"),
offColor: this.$element.data("off-color"),
onText: this.$element.data("on-text"),
offText: this.$element.data("off-text"),
labelText: this.$element.data("label-text"),
baseClass: this.$element.data("base-class"),
wrapperClass: this.$element.data("wrapper-class"),
radioAllOff: this.$element.data("radio-all-off")
wrapperClass: this.$element.data("wrapper-class")
}, options);
this.$wrapper = $("<div>", {
"class": (function(_this) {
Expand All @@ -68,6 +69,9 @@
if (_this.options.indeterminate) {
classes.push("" + _this.options.baseClass + "-indeterminate");
}
if (_this.options.inverse) {
classes.push("" + _this.options.baseClass + "-inverse");
}
if (_this.$element.attr("id")) {
classes.push("" + _this.options.baseClass + "-id-" + (_this.$element.attr("id")));
}
Expand Down Expand Up @@ -105,7 +109,7 @@
})(this));
this.$container = this.$element.wrap(this.$container).parent();
this.$wrapper = this.$container.wrap(this.$wrapper).parent();
this.$element.before(this.$on).before(this.$label).before(this.$off).trigger("init.bootstrapSwitch");
this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off).trigger("init.bootstrapSwitch");
this._elementHandlers();
this._handleHandlers();
this._labelHandlers();
Expand All @@ -118,22 +122,32 @@
if (typeof value === "undefined") {
return this.options.state;
}
if (this.options.disabled || this.options.readonly || this.options.indeterminate) {
if (this.options.disabled || this.options.readonly) {
return this.$element;
}
if (this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) {
return this.$element;
}
value = !!value;
if (this.options.indeterminate) {
this.indeterminate(false);
value = true;
} else {
value = !!value;
}
this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip);
return this.$element;
};

BootstrapSwitch.prototype.toggleState = function(skip) {
if (this.options.disabled || this.options.readonly || this.options.indeterminate) {
if (this.options.disabled || this.options.readonly) {
return this.$element;
}
return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip);
if (this.options.indeterminate) {
this.indeterminate(false);
return this.state(true);
} else {
return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip);
}
};

BootstrapSwitch.prototype.size = function(value) {
Expand All @@ -160,6 +174,12 @@
return this.$element;
};

BootstrapSwitch.prototype.toggleAnimate = function() {
this.$wrapper.toggleClass("" + this.options.baseClass + "-animate");
this.options.animate = !this.options.animate;
return this.$element;
};

BootstrapSwitch.prototype.disabled = function(value) {
if (typeof value === "undefined") {
return this.options.disabled;
Expand Down Expand Up @@ -214,6 +234,36 @@
return this.$element;
};

BootstrapSwitch.prototype.inverse = function(value) {
var $off, $on;
if (typeof value === "undefined") {
return this.options.inverse;
}
value = !!value;
this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-inverse");
$on = this.$on.clone(true);
$off = this.$off.clone(true);
this.$on.replaceWith($off);
this.$off.replaceWith($on);
this.$on = $off;
this.$off = $on;
this.options.inverse = value;
return this.$element;
};

BootstrapSwitch.prototype.toggleInverse = function() {
var $off, $on;
this.$wrapper.toggleClass("" + this.options.baseClass + "-inverse");
$on = this.$on.clone(true);
$off = this.$off.clone(true);
this.$on.replaceWith($off);
this.$off.replaceWith($on);
this.$on = $off;
this.$off = $on;
this.options.inverse = !this.options.inverse;
return this.$element;
};

BootstrapSwitch.prototype.onColor = function(value) {
var color;
color = this.options.onColor;
Expand Down Expand Up @@ -362,7 +412,7 @@
})(this),
"keydown.bootstrapSwitch": (function(_this) {
return function(e) {
if (!e.which || _this.options.disabled || _this.options.readonly || _this.options.indeterminate) {
if (!e.which || _this.options.disabled || _this.options.readonly) {
return;
}
switch (e.which) {
Expand Down Expand Up @@ -423,7 +473,7 @@
})(this),
"mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) {
return function(e) {
if (_this.isLabelDragging || _this.options.disabled || _this.options.readonly || _this.options.indeterminate) {
if (_this.isLabelDragging || _this.options.disabled || _this.options.readonly) {
return;
}
e.preventDefault();
Expand All @@ -433,13 +483,15 @@
})(this),
"mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) {
return function(e) {
var state;
if (!_this.isLabelDragging) {
return;
}
e.preventDefault();
if (_this.isLabelDragged) {
state = parseInt(_this.$container.css("margin-left"), 10) > -(_this.$container.width() / 6);
_this.isLabelDragged = false;
_this.state(parseInt(_this.$container.css("margin-left"), 10) > -(_this.$container.width() / 6));
_this.state(_this.options.inverse ? !state : state);
if (_this.options.animate) {
_this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
}
Expand Down Expand Up @@ -516,14 +568,15 @@
disabled: false,
readonly: false,
indeterminate: false,
inverse: false,
radioAllOff: false,
onColor: "primary",
offColor: "default",
onText: "ON",
offText: "OFF",
labelText: "&nbsp;",
baseClass: "bootstrap-switch",
wrapperClass: "wrapper",
radioAllOff: false,
onInit: function() {},
onSwitchChange: function() {}
};
Expand Down
124 changes: 78 additions & 46 deletions vendor/assets/stylesheets/bootstrap2-switch.css.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ========================================================================
* bootstrap-switch - v3.0.2
* bootstrap-switch - v3.1.0
* http://www.bootstrap-switch.org
* ========================================================================
* Copyright 2012-2013 Mattia Larentis
Expand Down Expand Up @@ -103,55 +103,58 @@
font-size: 16px;
line-height: normal;
}
.bootstrap-switch.bootstrap-switch-disabled,
.bootstrap-switch.bootstrap-switch-readonly,
.bootstrap-switch.bootstrap-switch-indeterminate {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default !important;
}
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label {
cursor: default !important;
}
.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container {
-webkit-transition: margin-left 0.5s;
-moz-transition: margin-left 0.5s;
-o-transition: margin-left 0.5s;
transition: margin-left 0.5s;
}
.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-container {
margin-left: 0%;
}
.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label {
.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on {
-webkit-border-top-left-radius: 0;
-moz-border-radius-topleft: 0;
border-top-left-radius: 0;
-webkit-border-bottom-left-radius: 0;
-moz-border-radius-bottomleft: 0;
border-bottom-left-radius: 0;
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
border-bottom-right-radius: 4px;
}
.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-container {
margin-left: -50%;
}
.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label {
.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off {
-webkit-border-top-right-radius: 0;
-moz-border-radius-topright: 0;
border-top-right-radius: 0;
-webkit-border-bottom-right-radius: 0;
-moz-border-radius-bottomright: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-left-radius: 4px;
}
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-container {
margin-left: -25%;
}
.bootstrap-switch.bootstrap-switch-disabled,
.bootstrap-switch.bootstrap-switch-readonly,
.bootstrap-switch.bootstrap-switch-indeterminate {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default !important;
}
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,
.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label {
cursor: default !important;
}
.bootstrap-switch.bootstrap-switch-focused {
border-color: rgba(82, 168, 236, 0.8);
outline: 0;
Expand All @@ -160,6 +163,35 @@
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82, 168, 236, .6);
}
.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-container,
.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-container {
margin-left: 0%;
}
.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label {
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
border-bottom-right-radius: 4px;
}
.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-container,
.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-container {
margin-left: -50%;
}
.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label,
.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label {
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-left-radius: 4px;
}
.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-container {
margin-left: -25%;
}
.bootstrap-switch .bootstrap-switch-container {
display: inline-block;
width: 150%;
Expand Down Expand Up @@ -432,22 +464,6 @@
.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.active {
background-color: #e6e6e6 \9;
}
.bootstrap-switch .bootstrap-switch-handle-on {
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-left-radius: 4px;
}
.bootstrap-switch .bootstrap-switch-handle-off {
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
border-bottom-right-radius: 4px;
}
.bootstrap-switch .bootstrap-switch-label {
text-align: center;
margin-top: -1px;
Expand Down Expand Up @@ -486,6 +502,22 @@
.bootstrap-switch .bootstrap-switch-label.active {
background-color: #cccccc \9;
}
.bootstrap-switch .bootstrap-switch-handle-on {
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-left-radius: 4px;
}
.bootstrap-switch .bootstrap-switch-handle-off {
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
border-bottom-right-radius: 4px;
}
.bootstrap-switch input[type='radio'],
.bootstrap-switch input[type='checkbox'] {
position: absolute !important;
Expand Down
Loading

0 comments on commit 453e74f

Please sign in to comment.