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

pull/23/head
kay.one 12 years ago
parent 30595e85a3
commit 19dfd49ad3

@ -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);
};
Loading…
Cancel
Save