You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
677 B
JavaScript

define([
'underscore',
'marionette',
'core/layout/view',
'core/layout/model'
], function LayoutModuleDefine(_, Marionette, LayoutView, LayoutModel) {
'use strict';
var LayoutModule = Marionette.Module.extend({
Model: LayoutModel,
View: LayoutView,
onStart: function(options) {
var opts = _.defaults({}, options || {}, {layout: {}});
_.defaults(opts.layout, {view: {}, model: {}});
var config = opts.layout;
this.model = new this.Model(config.model);
config.view.model = this.model;
this.view = new this.View(config.view);
this.model.fetch();
this.view.render();
}
});
return LayoutModule;
});