1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 09:18:34 +00:00

added view name as class to DOM element for easier debugging.

This commit is contained in:
kay.one 2013-04-10 21:28:17 -07:00
parent 30595e85a3
commit 19dfd49ad3

View file

@ -3,13 +3,27 @@
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);
}
console.log("render");
this.$el.addClass('iv-' + this.viewName());
return oldItemViewRender.apply(this, arguments);
};
@ -20,7 +34,5 @@ Marionette.CollectionView.prototype.render = function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
}
console.log("render");
return oldItemCollectionViewRender.apply(this, arguments);
};
};