Skip to content
Snippets Groups Projects

Resolve "Admin panel: "Confirm remove" messages"

Merged Piotr Gawron requested to merge 316-admin-panel-confirm-remove-messages into master
7 files
+ 148
26
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -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,48 @@ 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) {
var html;
var content = '';
if (params.content) {
content = params.content;
}
if (params.input) {
html = '<form><input type="text" style="z-index:10000" name="name"><br></form>';
} else {
html = '<form><span>' + content + '</span><input type="text" style="z-index:10000;visibility: hidden"><br></form>';
}
$(html).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;
Loading