don't add named views in production
This commit is contained in:
parent
b3f11564a7
commit
bc037e7319
|
@ -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;
|
||||
};
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue