1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01: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 oldItemViewRender = Marionette.ItemView.prototype.render;
var oldItemCollectionViewRender = Marionette.CollectionView.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 () { Marionette.ItemView.prototype.render = function () {
if (this.model) { if (this.model) {
NzbDrone.ModelBinder.bind(this.model, this.el); NzbDrone.ModelBinder.bind(this.model, this.el);
} }
console.log("render"); this.$el.addClass('iv-' + this.viewName());
return oldItemViewRender.apply(this, arguments); return oldItemViewRender.apply(this, arguments);
}; };
@ -20,7 +34,5 @@ Marionette.CollectionView.prototype.render = function () {
NzbDrone.ModelBinder.bind(this.model, this.el); NzbDrone.ModelBinder.bind(this.model, this.el);
} }
console.log("render");
return oldItemCollectionViewRender.apply(this, arguments); return oldItemCollectionViewRender.apply(this, arguments);
}; };