fixed bootstrap switches. still need to listen to checkbox event.

pull/23/head
kay.one 12 years ago
parent d85b825e06
commit 27f45cfdee

@ -17,15 +17,18 @@ Marionette.View.prototype.viewName = function () {
return undefined; return undefined;
}; };
Marionette.ItemView.prototype.self$ = function (selector) {
return this.$(selector).not("[class*='iv-'] " + selector);
};
Marionette.ItemView.prototype.render = function () { Marionette.ItemView.prototype.render = function () {
var result = oldItemViewRender.apply(this, arguments); var result = oldItemViewRender.apply(this, arguments);
//check to see if el has bindings (name attribute) //check to see if el has bindings (name attribute)
// any element that has a name attribute and isn't child of another view. // 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) { if (!this.model) {
throw 'view ' + this.viewName() + ' has binding attributes but model is not defined'; 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._modelBinder.bind(this.model, this.el);
} }
this.self$('.switch').bootstrapSwitch();
this.$el.addClass('iv-' + this.viewName()); this.$el.addClass('iv-' + this.viewName());
return result; return result;
}; };

@ -9,8 +9,7 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
ui: { ui: {
progressbar : '.progress .bar', progressbar : '.progress .bar',
qualityProfile : '.x-quality-profile', qualityProfile : '.x-quality-profile',
backlogSettings: '.x-backlog-setting', backlogSettings: '.x-backlog-setting'
bsSwitch : '.switch'
}, },
events: { events: {
@ -18,10 +17,6 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
'click .x-remove': 'removeSeries' 'click .x-remove': 'removeSeries'
}, },
onRender: function () {
this.ui.bsSwitch.bootstrapSwitch();
},
saveSeries: function () { saveSeries: function () {
//Todo: Get qualityProfile + backlog setting from UI //Todo: Get qualityProfile + backlog setting from UI

@ -32,7 +32,7 @@
<div class="controls"> <div class="controls">
<div class="switch"> <div class="switch">
<input type="checkbox" name="useSceneName"/> <input type="checkbox" name="downloadClientUseSceneName"/>
</div> </div>
<span class="help-inline-checkbox"> <span class="help-inline-checkbox">
<i class="icon-question-sign" title="Use Scene name when adding NZB to queue?"></i> <i class="icon-question-sign" title="Use Scene name when adding NZB to queue?"></i>

@ -25,7 +25,6 @@ define([
}, },
onRender: function () { onRender: function () {
this.ui.bsSwitch.bootstrapSwitch();
this.ui.tooltip.tooltip({ placement: 'right', html: true }); this.ui.tooltip.tooltip({ placement: 'right', html: true });
this.ui.pathInput.autoComplete('/directories'); this.ui.pathInput.autoComplete('/directories');

@ -10,12 +10,10 @@ define([
className: 'form-horizontal', className: 'form-horizontal',
ui: { ui: {
bsSwitch : '.switch',
tooltip: '[class^="help-inline"] i' tooltip: '[class^="help-inline"] i'
}, },
onRender: function () { onRender: function () {
this.ui.bsSwitch.bootstrapSwitch();
this.ui.tooltip.tooltip({ placement: 'right', html: true }); this.ui.tooltip.tooltip({ placement: 'right', html: true });
} }
}); });

@ -10,7 +10,6 @@ define([
className: 'form-horizontal', className: 'form-horizontal',
ui: { ui: {
bsSwitch : '.switch',
tooltip: '[class^="help-inline"] i' tooltip: '[class^="help-inline"] i'
}, },
@ -19,7 +18,6 @@ define([
}, },
onRender: function () { onRender: function () {
this.ui.bsSwitch.bootstrapSwitch();
this.ui.tooltip.tooltip({ placement: 'right' }); this.ui.tooltip.tooltip({ placement: 'right' });
} }
}); });

@ -6,18 +6,10 @@ define(['app', 'Quality/QualityProfileModel'], function () {
tagName : 'div', tagName : 'div',
className: "modal", className: "modal",
ui: {
bsSwitch: '.switch'
},
events: { events: {
'click .x-save': 'saveQualityProfile' 'click .x-save': 'saveQualityProfile'
}, },
onRender: function () {
this.ui.bsSwitch.bootstrapSwitch();
},
saveQualityProfile: function () { saveQualityProfile: function () {
//Todo: Make sure model is updated with Allowed, Cutoff, Name //Todo: Make sure model is updated with Allowed, Cutoff, Name

Loading…
Cancel
Save