From 7e6d914a1a668b1ee7c82d8b58da9442c3b0c81a Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 16 Aug 2017 18:06:13 +0200 Subject: [PATCH] user can remove overlays --- .../main/js/gui/admin/EditProjectDialog.js | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js index 209c068086..2dbf2bc598 100644 --- a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js +++ b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js @@ -305,6 +305,15 @@ EditProjectDialog.prototype._createOverlayTable = function() { }); }); + $(overlaysTable).on("click", "[name='downloadSource']", function() { + var button = this; + return ServerConnector.getOverlaySourceDownloadUrl({ + overlayId : $(button).attr("data") + }).then(function(url) { + return self.downloadFile(url); + }).then(null, GuiConnector.alert); + }); + return overlaysTable; }; @@ -327,13 +336,18 @@ EditProjectDialog.prototype.createUsersTabContent = function() { }; EditProjectDialog.prototype.init = function() { + var self = this; + return self.refreshOverlays().then(function() { + $(window).trigger('resize'); + }); +}; + +EditProjectDialog.prototype.refreshOverlays = function() { var self = this; return ServerConnector.getOverlays({ projectId : self.getProject().getProjectId() }).then(function(overlays) { return self.setOverlays(overlays); - }).then(function() { - $(window).trigger('resize'); }); }; @@ -460,5 +474,13 @@ EditProjectDialog.prototype.saveOverlay = function(overlayId) { return ServerConnector.updateOverlay(overlay); }; +EditProjectDialog.prototype.removeOverlay = function(overlayId) { + var self = this; + return ServerConnector.removeOverlay({ + overlayId : overlayId + }).then(function() { + return self.refreshOverlays(); + }); +}; module.exports = EditProjectDialog; -- GitLab