From 53744a739a9ed8bab2e7b468917b3b00dbee79e0 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Thu, 2 Aug 2018 14:47:59 +0200 Subject: [PATCH] EditGenomeDialog manages tabs via guiUtils --- .../src/main/js/gui/admin/EditGenomeDialog.js | 100 ++---------------- 1 file changed, 7 insertions(+), 93 deletions(-) diff --git a/frontend-js/src/main/js/gui/admin/EditGenomeDialog.js b/frontend-js/src/main/js/gui/admin/EditGenomeDialog.js index ff90758262..6b26fd513a 100644 --- a/frontend-js/src/main/js/gui/admin/EditGenomeDialog.js +++ b/frontend-js/src/main/js/gui/admin/EditGenomeDialog.js @@ -68,109 +68,23 @@ EditGenomeDialog.prototype.isNew = function () { */ EditGenomeDialog.prototype.createGui = function () { var self = this; - var element = self.getElement(); - var tabDiv = Functions.createElement({ - type: "div", - name: "tabView", - className: "tabbable boxed parentTabs", - style: "position:absolute;top:10px;bottom:40px;left:10px;right:10px" - }); - element.appendChild(tabDiv); - - var tabMenuDiv = Functions.createElement({ - type: "ul", - className: "nav nav-tabs" - }); - tabDiv.appendChild(tabMenuDiv); + guiUtils.initTabContent(self); - var tabContentDiv = Functions.createElement({ - type: "div", - className: "tab-content", - style: "height:100%" - }); - tabDiv.appendChild(tabContentDiv); - - self.createGeneralTab(tabMenuDiv, tabContentDiv); - self.createGeneMappingTab(tabMenuDiv, tabContentDiv); - $("a", tabMenuDiv).bind("click", function () { - //workaround for some css issues... - tabDiv.style.top = "40px"; - tabDiv.style.bottom = "10px"; - }); - -}; - -/** - * - * @param {HTMLElement} tabMenuDiv - * @param {HTMLElement} tabContentDiv - */ -EditGenomeDialog.prototype.createGeneralTab = function (tabMenuDiv, tabContentDiv) { - var self = this; - self.addTab({ - tabMenuDiv: tabMenuDiv, - tabContentDiv: tabContentDiv, + guiUtils.addTab(self,{ name: "DETAILS", content: self.createGeneralTabContent() }); - -}; - -/** - * - * @param {HTMLElement} tabMenuDiv - * @param {HTMLElement} tabContentDiv - */ -EditGenomeDialog.prototype.createGeneMappingTab = function (tabMenuDiv, tabContentDiv) { - var self = this; - self.addTab({ - tabMenuDiv: tabMenuDiv, - tabContentDiv: tabContentDiv, + guiUtils.addTab(self,{ name: "GENE MAPPING", content: self.createGeneMappingTabContent() }); -}; - -var id_counter = 0; - -/** - * - * @param {string} tab_name - * @returns {string} - */ -EditGenomeDialog.prototype.generateTabId = function (tab_name) { - var self = this; - var id = self.getReferenceGenome().getId(); - if (id === undefined) { - id = "new_genome_" + (id_counter++); - } - return id + tab_name.replace(" ", "_") + "_TAB"; -}; - -EditGenomeDialog.prototype.addTab = function (params) { - var id = this.generateTabId(params.name); - - var navLi = guiUtils.createTabMenuObject({ - id: id, - name: params.name, - navigationBar: params.tabMenuDiv - }); - params.tabMenuDiv.appendChild(navLi); - - var contentDiv = guiUtils.createTabContentObject({ - id: id, - navigationObject: navLi, - navigationBar: params.tabMenuDiv + $(".nav-tabs > li > a", self.getElement()).bind("click", function () { + //workaround for some css issues... + $(".parentTabs", self.getElement()).css("top", "40px"); + $(".parentTabs", self.getElement()).css("bottom", "10px"); }); - - $(contentDiv).css("overflow", "auto"); - if (params.content !== undefined) { - contentDiv.appendChild(params.content); - } - - params.tabContentDiv.appendChild(contentDiv); }; /** -- GitLab