mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Replaced bootstrap switch with css only version!
This commit is contained in:
parent
bafb742141
commit
6636b77489
10 changed files with 89 additions and 804 deletions
|
@ -1,59 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var oldItemViewRender = Marionette.ItemView.prototype.render;
|
||||
var oldItemCollectionViewRender = Marionette.CollectionView.prototype.render;
|
||||
|
||||
|
||||
Marionette.View.prototype.viewName = function () {
|
||||
if (this.template) {
|
||||
var regex = new RegExp('\/', 'g');
|
||||
|
||||
return this.template
|
||||
.toLocaleLowerCase()
|
||||
.replace('template', '')
|
||||
.replace(regex, '-');
|
||||
}
|
||||
|
||||
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.self$('[name]').length > 0) {
|
||||
if (!this.model) {
|
||||
throw 'view ' + this.viewName() + ' has binding attributes but model is not defined';
|
||||
}
|
||||
|
||||
if (!this._modelBinder) {
|
||||
this._modelBinder = new Backbone.ModelBinder();
|
||||
}
|
||||
|
||||
window.console.log('binding ' + this.viewName());
|
||||
|
||||
this._modelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
this.self$('.switch').bootstrapSwitch();
|
||||
this.$el.addClass('iv-' + this.viewName());
|
||||
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Marionette.CollectionView.prototype.render = function () {
|
||||
|
||||
if (this.model) {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
return oldItemCollectionViewRender.apply(this, arguments);
|
||||
};
|
|
@ -42,7 +42,6 @@ Marionette.ItemView.prototype.render = function () {
|
|||
this._modelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
this.self$('.switch').bootstrapSwitch();
|
||||
this.$el.addClass('iv-' + this.viewName());
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue