1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00
Radarr/UI/Mixins/AsNamedView.js

39 lines
887 B
JavaScript
Raw Normal View History

2013-06-19 03:02:23 +02:00
'use strict';
define(
function () {
return function () {
this.viewName = function () {
if (this.template) {
var regex = new RegExp('\/', 'g');
return this.template
.toLocaleLowerCase()
.replace('template', '')
.replace(regex, '-');
}
return undefined;
};
var originalOnRender = this.onRender;
this.onRender = function () {
this.$el.removeClass('iv-' + this.viewName());
this.$el.addClass('iv-' + this.viewName());
if (originalOnRender) {
return originalOnRender.call(this);
}
return undefined;
};
return this;
};
}
);