mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Add admin field application
This commit is contained in:

committed by
Romain Neutron

parent
7199d38ab3
commit
05dc3659af
44
www/scripts/apps/admin/fields/views/modal.js
Normal file
44
www/scripts/apps/admin/fields/views/modal.js
Normal file
@@ -0,0 +1,44 @@
|
||||
define([
|
||||
'underscore',
|
||||
'backbone',
|
||||
'i18n',
|
||||
'bootstrap'
|
||||
], function(_, Backbone, i18n, bootstrap) {
|
||||
var ModalView = Backbone.View.extend({
|
||||
tagName: "div",
|
||||
className: "modal",
|
||||
events: {
|
||||
'click .confirm': 'confirmAction'
|
||||
},
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
// remove view when modal is closed
|
||||
this.$el.on('hidden', function() {
|
||||
self.remove();
|
||||
});
|
||||
|
||||
if (options) {
|
||||
this.message = options.message;
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
var template = _.template($("#modal_delete_confirm_template").html(), {
|
||||
msg: this.message || ''
|
||||
});
|
||||
|
||||
this.$el.html(template).modal();
|
||||
|
||||
return this;
|
||||
},
|
||||
confirmAction: function () {
|
||||
this.trigger('modal:confirm');
|
||||
this.$el.modal('hide');
|
||||
this.remove();
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
return ModalView;
|
||||
});
|
||||
|
Reference in New Issue
Block a user