Commit a2b698fb authored by Piotr Gawron's avatar Piotr Gawron
Browse files

confirmation dialog for project removal

parent 4de6b4cc
......@@ -32,7 +32,17 @@ 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({
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 () {
......
......@@ -139,7 +139,10 @@ CommentsAdminPanel.prototype.onProjectChange = function () {
dataTable.clear().rows.add(data).draw();
$("[name='commentsTable']", self.getElement()).on("click", "[name='removeComment']", function () {
var button = this;
return self.askConfirmRemoval({title: "Why do you want to remove this comment?"}).then(function (param) {
return self.askConfirmRemoval({
title: "Why do you want to remove this comment?",
input: true
}).then(function (param) {
if (param.status) {
return ServerConnector.removeComment({
commentId: $(button).attr("data"),
......
......@@ -114,7 +114,15 @@ MapsAdminPanel.prototype._createProjectTableRow = function () {
});
$(projectsTable).on("click", "[name='removeProject']", function () {
var button = this;
return self.removeProject($(button).attr("data")).then(null, GuiConnector.alert);
return self.askConfirmRemoval({
title: "INFO",
content: "Do you really want to remove this map?",
input: false
}).then(function (param) {
if (param.status) {
return self.removeProject($(button).attr("data"))
}
}).catch(GuiConnector.alert);
});
$(projectsTable).on("click", "[name='showEditDialog']", function () {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment