Initial commit
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
var CoreView = require('backbone/core-view');
|
||||
var template = require('./footer.tpl');
|
||||
|
||||
module.exports = CoreView.extend({
|
||||
|
||||
tagName: 'ul',
|
||||
className: 'Modal-listActions u-flex u-alignCenter ',
|
||||
|
||||
events: {
|
||||
'click .js-save': '_save',
|
||||
'click .js-close': '_close'
|
||||
},
|
||||
|
||||
initialize: function (opts) {
|
||||
if (!opts.visMetadataModel) throw new Error('visMetadataModel is required');
|
||||
if (!opts.onSaveAction) throw new Error('onSaveAction is required');
|
||||
|
||||
this._visMetadataModel = opts.visMetadataModel;
|
||||
this._onSaveAction = opts.onSaveAction;
|
||||
this._onCloseAction = opts.onCloseAction;
|
||||
this._initBinds();
|
||||
},
|
||||
|
||||
_initBinds: function () {
|
||||
this._visMetadataModel.on('change', this.render, this);
|
||||
},
|
||||
|
||||
render: function () {
|
||||
this.$el.html(
|
||||
template({
|
||||
canFinish: this._visMetadataModel.isValid()
|
||||
})
|
||||
);
|
||||
return this;
|
||||
},
|
||||
|
||||
_save: function () {
|
||||
this._visMetadataModel.isValid() && this._onSaveAction();
|
||||
},
|
||||
|
||||
_close: function () {
|
||||
this._onCloseAction && this._onCloseAction();
|
||||
}
|
||||
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<li class="Modal-listActionsitem">
|
||||
<button class="CDB-Button CDB-Button--secondary CDB-Button--big js-close">
|
||||
<span class="CDB-Button-Text CDB-Text is-semibold CDB-Size-medium u-upperCase">
|
||||
<%- _t('components.modals.maps-metadata.cancel-btn') %>
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
<li class="Modal-listActionsitem">
|
||||
<button class="CDB-Button CDB-Button--primary CDB-Button--big js-save <%- canFinish ? '' : 'is-disabled' %>">
|
||||
<span class="CDB-Button-Text CDB-Text is-semibold CDB-Size-medium u-upperCase ">
|
||||
<%- _t('components.modals.maps-metadata.save-btn') %>
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user