cartodb/lib/assets/javascripts/dashboard/views/api-keys/alert-dialog-view.js
2020-06-15 10:58:47 +08:00

33 lines
647 B
JavaScript

const CoreView = require('backbone/core-view');
const checkAndBuildOpts = require('builder/helpers/required-opts');
var REQUIRED_OPTS = [
'modalModel',
'onSubmit',
'template'
];
module.exports = CoreView.extend({
events: {
'click .js-submit': '_onSubmitClicked',
'click .js-cancel': '_closeDialog'
},
initialize: function (options) {
checkAndBuildOpts(options, REQUIRED_OPTS, this);
},
render: function () {
return this.$el.html(this._template());
},
_onSubmitClicked: function () {
this._onSubmit();
this._closeDialog();
},
_closeDialog: function () {
this._modalModel.destroy();
}
});