1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

don't add named views in production

This commit is contained in:
Keivan Beigi 2015-02-03 15:33:13 -08:00
parent b3f11564a7
commit bc037e7319
3 changed files with 20 additions and 12 deletions

View File

@ -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;
}; };

View File

@ -31,11 +31,11 @@ module.exports = Marionette.Layout.extend({
search : '.x-search' search : '.x-search'
}, },
events : { events : {
"click .x-monitored" : '_toggleMonitored', 'click .x-monitored' : '_toggleMonitored',
"click .x-edit" : '_editSeries', 'click .x-edit' : '_editSeries',
"click .x-refresh" : '_refreshSeries', 'click .x-refresh' : '_refreshSeries',
"click .x-rename" : '_renameSeries', 'click .x-rename' : '_renameSeries',
"click .x-search" : '_seriesSearch' 'click .x-search' : '_seriesSearch'
}, },
initialize : function(){ initialize : function(){
this.seriesCollection = SeriesCollection.clone(); this.seriesCollection = SeriesCollection.clone();

View File

@ -7,6 +7,9 @@ var templateMixin = require('../Handlebars/backbone.marionette.templates');
var asNamedView = require('../Mixins/AsNamedView'); var asNamedView = require('../Mixins/AsNamedView');
templateMixin.call(window.Marionette.TemplateCache); templateMixin.call(window.Marionette.TemplateCache);
asNamedView.call(window.Marionette.ItemView.prototype);
if(!window.NzbDrone.Production) {
asNamedView.call(window.Marionette.ItemView.prototype);
}
module.exports = window.Marionette; module.exports = window.Marionette;