cartodb-4.42/lib/assets/javascripts/builder/editor/settings/preview/preview-view.js
2024-04-06 05:25:13 +00:00

38 lines
882 B
JavaScript
Executable File

var CoreView = require('backbone/core-view');
var _ = require('underscore');
var OptionsView = require('./preview-options-view');
var REQUIRED_OPTS = [
'mapDefinitionModel',
'settingsCollection',
'overlaysCollection'
];
module.exports = CoreView.extend({
initialize: function (opts) {
_.each(REQUIRED_OPTS, function (item) {
if (!opts[item]) throw new Error(item + ' is required');
this['_' + item] = opts[item];
}, this);
},
render: function () {
this.clearSubViews();
this.$el.empty();
this._renderOptions();
return this;
},
_renderOptions: function () {
var view = new OptionsView({
mapDefinitionModel: this._mapDefinitionModel,
settingsCollection: this._settingsCollection,
overlaysCollection: this._overlaysCollection
});
this.$el.append(view.render().el);
this.addView(view);
}
});