Skip to content
Snippets Groups Projects
Commit 4de6b4cc authored by Piotr Gawron's avatar Piotr Gawron
Browse files

confirmation dialog moved to general admin panel class

parent c6489b26
No related branches found
No related tags found
1 merge request!233Resolve "Admin panel: "Confirm remove" messages"
......@@ -5,6 +5,7 @@
var Panel = require('../Panel');
// noinspection JSUnusedLocalSymbols
var logger = require('../../logger');
var Functions = require('../../Functions');
var Promise = require("bluebird");
......@@ -18,15 +19,38 @@ function AbstractAdminPanel(params) {
AbstractAdminPanel.prototype = Object.create(Panel.prototype);
AbstractAdminPanel.prototype.constructor = AbstractAdminPanel;
AbstractAdminPanel.prototype._createHeader = function(name) {
AbstractAdminPanel.prototype._createHeader = function (name) {
this.getElement().appendChild(Functions.createElement({
type : "h1",
content : name
type: "h1",
content: name
}));
};
AbstractAdminPanel.prototype.init = function() {
AbstractAdminPanel.prototype.init = function () {
};
AbstractAdminPanel.prototype.askConfirmRemoval = function (params) {
return new Promise(function (resolve) {
$('<form><input type="text" style="z-index:10000" name="name"><br></form>').dialog({
modal: true,
title: params.title,
close: function () {
$(this).dialog('destroy').remove();
resolve({status: false});
},
buttons: {
'OK': function () {
$(this).dialog('destroy').remove();
resolve({reason: $('input[name="name"]').val(), status: true});
},
'Cancel': function () {
$(this).dialog('destroy').remove();
resolve({status: false});
}
}
});
})
};
module.exports = AbstractAdminPanel;
......@@ -211,27 +211,5 @@ CommentsAdminPanel.prototype.destroy = function () {
}
};
CommentsAdminPanel.prototype.askConfirmRemoval = function (params) {
return new Promise(function (resolve) {
$('<form><input type="text" style="z-index:10000" name="name"><br></form>').dialog({
modal: true,
title: params.title,
close: function () {
$(this).dialog('destroy').remove();
resolve({status: false});
},
buttons: {
'OK': function () {
$(this).dialog('destroy').remove();
resolve({reason: $('input[name="name"]').val(), status: true});
},
'Cancel': function () {
$(this).dialog('destroy').remove();
resolve({status: false});
}
}
});
})
};
module.exports = CommentsAdminPanel;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment