Partially migrate newsletter editor to Marionette 3.x from 2.x

This commit is contained in:
Tautvidas Sipavičius
2017-03-27 12:06:00 +03:00
parent 4f5c464659
commit 0b8c787cda
25 changed files with 261 additions and 228 deletions

View File

@@ -46,11 +46,14 @@ define([
},
});
Module.StylesView = Marionette.ItemView.extend({
Module.StylesView = Marionette.View.extend({
getTemplate: function() { return templates.styles; },
modelEvents: {
'change': 'render',
},
serializeData: function() {
return this.model.toJSON();
}
});
Module._globalStyles = new SuperModel();
@@ -65,7 +68,7 @@ define([
return App.getConfig().get('availableStyles');
};
App.on('before:start', function(options) {
App.on('before:start', function(App, options) {
// Expose style methods to global application
App.getGlobalStyles = Module.getGlobalStyles;
App.setGlobalStyles = Module.setGlobalStyles;
@@ -76,9 +79,9 @@ define([
this.setGlobalStyles(globalStyles);
});
App.on('start', function(options) {
App.on('start', function(App, options) {
var stylesView = new Module.StylesView({ model: App.getGlobalStyles() });
App._appView.stylesRegion.show(stylesView);
App._appView.showChildView('stylesRegion', stylesView);
});
return Module;