parent
b3f11564a7
commit
bc037e7319
@ -1,19 +1,24 @@
|
|||||||
module.exports = function(){
|
module.exports = function(){
|
||||||
this.viewName = function(){
|
|
||||||
if(this.template) {
|
var regex = new RegExp('/', 'g');
|
||||||
var regex = new RegExp('/', 'g');
|
|
||||||
return this.template.toLocaleLowerCase().replace('template', '').replace(regex, '-');
|
var _getViewName = function(template){
|
||||||
|
if(template) {
|
||||||
|
return template.toLocaleLowerCase().replace('template', '').replace(regex, '-');
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
var originalOnRender = this.onRender;
|
var originalOnRender = this.onRender;
|
||||||
this.onRender = function(){
|
this.onRender = function(){
|
||||||
this.$el.removeClass('iv-' + this.viewName());
|
this.$el.addClass('iv-' + _getViewName(this.template));
|
||||||
this.$el.addClass('iv-' + this.viewName());
|
|
||||||
if(originalOnRender) {
|
if(originalOnRender) {
|
||||||
return originalOnRender.call(this);
|
return originalOnRender.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
Loading…
Reference in new issue