1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 17:57:43 +00: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(){
this.viewName = function(){
if(this.template) {
var regex = new RegExp('/', 'g');
return this.template.toLocaleLowerCase().replace('template', '').replace(regex, '-');
var regex = new RegExp('/', 'g');
var _getViewName = function(template){
if(template) {
return 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());
this.$el.addClass('iv-' + _getViewName(this.template));
if(originalOnRender) {
return originalOnRender.call(this);
}
return undefined;
};
return this;
};

View file

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

View file

@ -7,6 +7,9 @@ var templateMixin = require('../Handlebars/backbone.marionette.templates');
var asNamedView = require('../Mixins/AsNamedView');
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;