diff --git a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js index da8a57fb20a88e77dded706aacf7d1bb27558cd8..0fdb83742bf5ace6e8af18860f89f8e2a364190d 100644 --- a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js +++ b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js @@ -373,10 +373,6 @@ EditProjectDialog.prototype.open = function() { title : self.getProject().getProjectId(), width : window.innerWidth / 2, height : window.innerHeight / 2, - modal : true, - close : function(event, ui) { - $(this).dialog('destroy').remove(); - }, }); } $(div).dialog("open"); diff --git a/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js b/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js index c956c68be39dd6fd56e41d014fc5ecf60662e2cf..c57b9203403199c8b7b5a4562191dc01d2cbc796 100644 --- a/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js +++ b/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js @@ -205,10 +205,13 @@ MapsAdminPanel.prototype.onRefreshClicked = function() { }); }; -MapsAdminPanel.prototype.showEditDialog = function(id) { - GuiConnector.showProcessing(); - var dialog; - return ServerConnector.getProject(id).then(function(project) { +MapsAdminPanel.prototype.getDialog = function(project) { + var self = this; + if (self._dialogs === undefined) { + self._dialogs = []; + } + var dialog = self._dialogs[project.getProjectId()]; + if (dialog === undefined) { dialog = new EditProjectDialog({ element : Functions.createElement({ type : "div" @@ -216,8 +219,23 @@ MapsAdminPanel.prototype.showEditDialog = function(id) { project : project, customMap : null, }); - return dialog.init(); - }).then(function() { + self._dialogs[project.getProjectId()] = dialog; + return dialog.init().then(function() { + return dialog; + }); + } else { + return Promise.resolve(dialog); + } +}; + +MapsAdminPanel.prototype.showEditDialog = function(id) { + var self = this; + GuiConnector.showProcessing(); + var dialog; + return ServerConnector.getProject(id).then(function(project) { + return self.getDialog(project); + }).then(function(dialog) { + dialog.open(); GuiConnector.hideProcessing(); }).then(null, function(error) {