cartodb/lib/assets/javascripts/builder/editor/components/overlay/overlay-view.js

23 lines
582 B
JavaScript
Raw Normal View History

2020-06-15 10:58:47 +08:00
var CoreView = require('backbone/core-view');
var template = require('./overlay.tpl');
module.exports = CoreView.extend({
initialize: function (opts) {
if (!opts.overlayModel) throw new Error('overlayModel is required');
this.overlayModel = opts.overlayModel;
this._initBinds();
},
render: function () {
this.$el.empty();
this.$el.append(template({
visible: !this.overlayModel.get('visible') ? 'is-hidden' : ''
}));
return this;
},
_initBinds: function () {
this.listenTo(this.overlayModel, 'change:visible', this.render);
}
});