From 61992143bbd99465f85041c5484520bc3f03b2e8 Mon Sep 17 00:00:00 2001 From: Bryan Brancotte Date: Wed, 5 May 2021 16:43:35 +0200 Subject: [PATCH] split standAloneSelectedElementHandler in multiple function in order to re-use it in tooltip, WIP #167 --- js/tree-edam-stand-alone.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/js/tree-edam-stand-alone.js b/js/tree-edam-stand-alone.js index b349663c..965c3b17 100644 --- a/js/tree-edam-stand-alone.js +++ b/js/tree-edam-stand-alone.js @@ -203,12 +203,21 @@ function interactive_edam_browser(){ setUrlParameters(""); } $("#details-"+identifier).remove(); + var details = build_detail_panel(d, uri, branch_of_term, identifier, true); + fill_detail_panel(d, uri, branch_of_term, identifier, details); + fill_community_panel(d, uri, branch_of_term, identifier, details); + append_detail_panel_to_edam_accordion(d, uri, branch_of_term, identifier, details); + } + + function build_detail_panel (d, uri, branch_of_term, identifier, collapsed){ details = ""; details += '
'; details += '
'; details += '
'; details += '

'; - details += 'Details of term "" '; + details += (collapsed?'Details of term "':''); + details += ''; + details += (collapsed?'" ':''); // details += ''+branch_of_term+''; details += ''; details += ''; @@ -216,13 +225,17 @@ function interactive_edam_browser(){ details += ''; details += '

'; details += '
'; - details += '
'; + details += '
':''); details += '
'; details += '
'; details += '
'; details += '
'; details=$(details); details.find(".term-name-heading").text(d.data.text); + return details; + } + + function fill_detail_panel (d, uri, branch_of_term, identifier, details){ var table = details.find("tbody.details"); table.children().remove(); var table_parent = details.find("table").parent(); @@ -286,6 +299,9 @@ function interactive_edam_browser(){ } } }); + } + + function fill_community_panel (d, uri, branch_of_term, identifier, details){ var community = details.find("tbody.community"); var caller_b=biotool_api().get_for(current_branch, d.data.text, uri, d); if (caller_b.is_enabled()){ @@ -375,6 +391,9 @@ function interactive_edam_browser(){ community.parent().remove(); } details.find('[data-toggle="tooltip"]').tooltip(); + } + + function append_detail_panel_to_edam_accordion (d, uri, branch_of_term, identifier, details){ $("#edamAccordion").find(".panel-group").first().find(".collapse").collapse("hide"); var length=$("#edamAccordion").find(".panel-group").length; if(length>0){