diff --git a/Bootstrap.Admin/wwwroot/lib/bootstrap-toggle/js/bootstrap-toggle.js b/Bootstrap.Admin/wwwroot/lib/bootstrap-toggle/js/bootstrap-toggle.js index c3ad054d..533914ed 100644 --- a/Bootstrap.Admin/wwwroot/lib/bootstrap-toggle/js/bootstrap-toggle.js +++ b/Bootstrap.Admin/wwwroot/lib/bootstrap-toggle/js/bootstrap-toggle.js @@ -29,8 +29,7 @@ size: 'normal', style: '', width: null, - height: null, - defaultVal: '' + height: null } Toggle.prototype.defaults = function() { @@ -42,14 +41,11 @@ size: this.$element.attr('data-size') || Toggle.DEFAULTS.size, style: this.$element.attr('data-style') || Toggle.DEFAULTS.style, width: this.$element.attr('data-width') || Toggle.DEFAULTS.width, - height: this.$element.attr('data-height') || Toggle.DEFAULTS.height, - defaultVal: this.$element.attr('data-default-val') || Toggle.DEFAULTS.defaultVal, + height: this.$element.attr('data-height') || Toggle.DEFAULTS.height } } Toggle.prototype.render = function () { - if(this.options.defaultVal === '') this.$element.prop('checked', true); - this._onstyle = 'btn-' + this.options.onstyle this._offstyle = 'btn-' + this.options.offstyle var size = this.options.size === 'large' ? 'btn-lg' diff --git a/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js b/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js index fb43b6dc..252ececa 100644 --- a/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js +++ b/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js @@ -500,6 +500,17 @@ }); } + // extend bootstrap-toggle + if($.fn.bootstrapToggle) { + var toggle = $.fn.bootstrapToggle.Constructor; + var oldFunc = toggle.prototype.render; + toggle.prototype.render = function() { + var defaultVal = this.$element.attr('data-default-val') || ''; + if(defaultVal === '') this.$element.prop('checked', true); + oldFunc.call(this); + } + } + if (window.NProgress) { $(document).ajaxStart(function () { return NProgress.start();