diff --git a/UI/Mixins/backbone.modelbinder.mixin.js b/UI/Mixins/backbone.modelbinder.mixin.js index 91d610ca0..4ebc2a9cb 100644 --- a/UI/Mixins/backbone.modelbinder.mixin.js +++ b/UI/Mixins/backbone.modelbinder.mixin.js @@ -17,15 +17,18 @@ Marionette.View.prototype.viewName = function () { return undefined; }; +Marionette.ItemView.prototype.self$ = function (selector) { + return this.$(selector).not("[class*='iv-'] " + selector); +}; + Marionette.ItemView.prototype.render = function () { var result = oldItemViewRender.apply(this, arguments); - //check to see if el has bindings (name attribute) // any element that has a name attribute and isn't child of another view. - if (this.$('[name]').not("[class*='iv-'] [name]").length > 0) { + if (this.self$('[name]').length > 0) { if (!this.model) { throw 'view ' + this.viewName() + ' has binding attributes but model is not defined'; } @@ -39,7 +42,10 @@ Marionette.ItemView.prototype.render = function () { this._modelBinder.bind(this.model, this.el); } + this.self$('.switch').bootstrapSwitch(); this.$el.addClass('iv-' + this.viewName()); + + return result; }; diff --git a/UI/Series/Edit/EditSeriesView.js b/UI/Series/Edit/EditSeriesView.js index f4ded82ba..1cb8f01d2 100644 --- a/UI/Series/Edit/EditSeriesView.js +++ b/UI/Series/Edit/EditSeriesView.js @@ -9,8 +9,7 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/ ui: { progressbar : '.progress .bar', qualityProfile : '.x-quality-profile', - backlogSettings: '.x-backlog-setting', - bsSwitch : '.switch' + backlogSettings: '.x-backlog-setting' }, events: { @@ -18,10 +17,6 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/ 'click .x-remove': 'removeSeries' }, - onRender: function () { - this.ui.bsSwitch.bootstrapSwitch(); - }, - saveSeries: function () { //Todo: Get qualityProfile + backlog setting from UI diff --git a/UI/Settings/DownloadClient/DownloadClientTemplate.html b/UI/Settings/DownloadClient/DownloadClientTemplate.html index 853ab80f9..80da9b50a 100644 --- a/UI/Settings/DownloadClient/DownloadClientTemplate.html +++ b/UI/Settings/DownloadClient/DownloadClientTemplate.html @@ -32,7 +32,7 @@
- +
diff --git a/UI/Settings/DownloadClient/DownloadClientView.js b/UI/Settings/DownloadClient/DownloadClientView.js index f954fe8b2..ea7cfd409 100644 --- a/UI/Settings/DownloadClient/DownloadClientView.js +++ b/UI/Settings/DownloadClient/DownloadClientView.js @@ -25,7 +25,6 @@ define([ }, onRender: function () { - this.ui.bsSwitch.bootstrapSwitch(); this.ui.tooltip.tooltip({ placement: 'right', html: true }); this.ui.pathInput.autoComplete('/directories'); diff --git a/UI/Settings/Misc/MiscView.js b/UI/Settings/Misc/MiscView.js index 1ce5da591..215d5738e 100644 --- a/UI/Settings/Misc/MiscView.js +++ b/UI/Settings/Misc/MiscView.js @@ -10,12 +10,10 @@ define([ className: 'form-horizontal', ui: { - bsSwitch : '.switch', tooltip: '[class^="help-inline"] i' }, onRender: function () { - this.ui.bsSwitch.bootstrapSwitch(); this.ui.tooltip.tooltip({ placement: 'right', html: true }); } }); diff --git a/UI/Settings/Naming/NamingView.js b/UI/Settings/Naming/NamingView.js index 17375ee75..2f61c6e87 100644 --- a/UI/Settings/Naming/NamingView.js +++ b/UI/Settings/Naming/NamingView.js @@ -10,7 +10,6 @@ define([ className: 'form-horizontal', ui: { - bsSwitch : '.switch', tooltip: '[class^="help-inline"] i' }, @@ -19,7 +18,6 @@ define([ }, onRender: function () { - this.ui.bsSwitch.bootstrapSwitch(); this.ui.tooltip.tooltip({ placement: 'right' }); } }); diff --git a/UI/Settings/Quality/Profile/EditQualityProfileView.js b/UI/Settings/Quality/Profile/EditQualityProfileView.js index 803293149..791772820 100644 --- a/UI/Settings/Quality/Profile/EditQualityProfileView.js +++ b/UI/Settings/Quality/Profile/EditQualityProfileView.js @@ -6,18 +6,10 @@ define(['app', 'Quality/QualityProfileModel'], function () { tagName : 'div', className: "modal", - ui: { - bsSwitch: '.switch' - }, - events: { 'click .x-save': 'saveQualityProfile' }, - onRender: function () { - this.ui.bsSwitch.bootstrapSwitch(); - }, - saveQualityProfile: function () { //Todo: Make sure model is updated with Allowed, Cutoff, Name