From 62f3384c25643e37ffb154d2f431e0159a5a668f Mon Sep 17 00:00:00 2001 From: valtena Date: Sun, 13 Mar 2022 23:20:59 +0100 Subject: [PATCH] fix js callback && simple click after close menu --- .../CYSFileLibrary.class.st | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/Telescope-Cytoscape-Libraries/CYSFileLibrary.class.st b/src/Telescope-Cytoscape-Libraries/CYSFileLibrary.class.st index 0c8b606..295a5e1 100644 --- a/src/Telescope-Cytoscape-Libraries/CYSFileLibrary.class.st +++ b/src/Telescope-Cytoscape-Libraries/CYSFileLibrary.class.st @@ -745,10 +745,8 @@ CYSFileLibrary >> cytoscapeTelescopeJs [ displayMenuForElement(element, visuId, position) { const that = this const menu = [] - const visu = this.visuWithId(visuId) function fun(name, evt) { - visu.menuIsOpen = false that.sendCommand([ { "id": visuId, @@ -760,7 +758,6 @@ CYSFileLibrary >> cytoscapeTelescopeJs [ } function subFun(name, evt) { - visu.menuIsOpen = false const selected = evt.currentTarget that.sendCommand([ { @@ -1120,20 +1117,31 @@ CYSFileLibrary >> cytoscapeTelescopeJs [ }) this.commandsAction.set("callbackUrl", (command, visu) => { - sendCallBack(command.callbackUrl, command.openInNewTab) + function post(path, cbId, openInNewTab) { + let form = $("
", {method: "post", action: path}); + if (openInNewTab) { + form.attr("target", "_blank"); + } + + var field = $("", {type: "hidden", name: cbId, value: "refresh"}); + form.append(field); + + // The form needs to be a part of the document in + // order for us to be able to submit it. + $(document.body).append(form); + form.submit(); + } + post(command.callbackUrl[0], command.callbackUrl[1], command.openInNewTab); }) // Called when we execute a Seaside ajax callback interaction this.commandsAction.set("ajax", (command, visu) => { let script = $(command.cssQuery).load(command.callbackUrl) - const container = visu.container() - container.classList.add("ajax-fetching") - $(command.cssQuery).load(command.callbackUrl, {}, () => { - if (command.onComplete) { - Function(command.onComplete)() - } - container.classList.remove("ajax-fetching") - }) + if(command.onComplete) { + $(command.cssQuery).load(command.callbackUrl,()=>{Function(command.onComplete)()}) + } else { + $(command.cssQuery).load(command.callbackUrl) + } }) this.commandsAction.set("generated", (command) => { @@ -2295,7 +2303,7 @@ CYSFileLibrary >> telescopeCss [ z-index: 100000 !important; } -.visualization.fetching::after, .visualization.ajax-fetching::after { +.visualization.fetching::after { content: "fetching"; position: absolute; bottom: 0px;