cartodb-4.42/lib/assets/javascripts/builder/components/tab-pane/tab-pane-label-view.js

27 lines
537 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
var CoreView = require('backbone/core-view');
var template = require('./tab-pane-label.tpl');
/**
* Label component
*/
module.exports = CoreView.extend({
className: 'Label',
initialize: function () {
if (!this.model) {
throw new Error('A model should be provided');
}
this.model.on('change:label', this.render, this);
},
render: function () {
this.$el.html(template({
label: this.model.get('label'),
selectedChild: this.model.get('selectedChild') || ''
}));
return this;
}
});