From 8557c11db50a8f3c50e125b7f71dddc5a5a343d9 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Fri, 30 Mar 2018 16:33:31 +0200 Subject: [PATCH] createHelpButton moved o GuiUtils --- frontend-js/src/main/js/gui/Panel.js | 24 +--------------- .../src/main/js/gui/leftPanel/GuiUtils.js | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/frontend-js/src/main/js/gui/Panel.js b/frontend-js/src/main/js/gui/Panel.js index ed0594d070..8264cfbb02 100644 --- a/frontend-js/src/main/js/gui/Panel.js +++ b/frontend-js/src/main/js/gui/Panel.js @@ -54,29 +54,7 @@ Panel.prototype.constructor = Panel; Panel.prototype.createHelpButton = function () { var self = this; - var helpTipButton = Functions.createElement({ - type: "button", - className: "minerva-help-button", - content: '<span class="ui-icon ui-icon-help" style="margin-left: -0.5em;"/>', - xss: false - }); - helpTipButton.onclick = function () { - var helpDialogDiv = Functions.createElement({ - type: "div", - content: xss(self.getHelpTip()) - }); - $(helpDialogDiv).dialog({ - close: function () { - $(this).dialog('destroy').remove(); - }, - position: { - my: "left top", - at: "left bottom", - of: helpTipButton - }, - }); - $('.ui-dialog').find("a").blur(); - }; + var helpTipButton = self.getGuiUtils().createHelpButton(self.getHelpTip()); self.getElement().appendChild(helpTipButton); }; diff --git a/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js b/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js index e1025958df..03f86f7ef2 100644 --- a/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js +++ b/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js @@ -669,4 +669,32 @@ GuiUtils.prototype.createTab = function (params) { } }; +GuiUtils.prototype.createHelpButton = function (toolTip) { + + var helpTipButton = Functions.createElement({ + type: "button", + className: "minerva-help-button", + content: '<span class="ui-icon ui-icon-help" style="margin-left: -0.5em;"/>', + xss: false + }); + helpTipButton.onclick = function () { + var helpDialogDiv = Functions.createElement({ + type: "div", + content: xss(toolTip) + }); + $(helpDialogDiv).dialog({ + close: function () { + $(this).dialog('destroy').remove(); + }, + position: { + my: "left top", + at: "left bottom", + of: helpTipButton + } + }); + $('.ui-dialog').find("a").blur(); + }; + return helpTipButton; +}; + module.exports = GuiUtils; -- GitLab