2013-04-11 03:24:34 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var oldItemViewRender = Marionette.ItemView.prototype.render;
|
|
|
|
var oldItemCollectionViewRender = Marionette.CollectionView.prototype.render;
|
|
|
|
|
2013-04-11 06:28:17 +02:00
|
|
|
|
|
|
|
Marionette.View.prototype.viewName = function () {
|
|
|
|
if (this.template) {
|
|
|
|
var regex = new RegExp('\/', 'g');
|
|
|
|
|
|
|
|
return this.template
|
|
|
|
.toLocaleLowerCase()
|
|
|
|
.replace('template','')
|
|
|
|
.replace(regex, '-');
|
|
|
|
}
|
|
|
|
|
|
|
|
return undefined;
|
|
|
|
};
|
|
|
|
|
2013-04-11 03:24:34 +02:00
|
|
|
Marionette.ItemView.prototype.render = function () {
|
|
|
|
|
|
|
|
if (this.model) {
|
|
|
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
|
|
|
}
|
|
|
|
|
2013-04-11 06:28:17 +02:00
|
|
|
this.$el.addClass('iv-' + this.viewName());
|
2013-04-11 03:24:34 +02:00
|
|
|
|
|
|
|
return oldItemViewRender.apply(this, arguments);
|
|
|
|
};
|
|
|
|
|
|
|
|
Marionette.CollectionView.prototype.render = function () {
|
|
|
|
|
|
|
|
if (this.model) {
|
|
|
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
|
|
|
}
|
|
|
|
|
|
|
|
return oldItemCollectionViewRender.apply(this, arguments);
|
2013-04-11 06:28:17 +02:00
|
|
|
};
|