You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/UI/Mixins/backbone.modelbinder.mixin.js

38 lines
897 B

'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.render = function () {
if (this.model) {
NzbDrone.ModelBinder.bind(this.model, this.el);
}
this.$el.addClass('iv-' + this.viewName());
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);
};