Skip to content

Commit

Permalink
split standAloneSelectedElementHandler in multiple function in order …
Browse files Browse the repository at this point in the history
…to re-use it in tooltip, WIP #167
  • Loading branch information
bryan-brancotte committed May 5, 2021
1 parent afd2ed8 commit 6199214
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions js/tree-edam-stand-alone.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,26 +203,39 @@ 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 += '<div class="panel-group edam-details" id="details-'+identifier+'">';
details += '<div class="panel panel-default border-edam-'+branch_of_term+'">';
details += '<div class="panel-heading xbg-edam-'+branch_of_term+'-light">';
details += '<h4 class="panel-title">';
details += '<a data-toggle="collapse" href="#collapse-'+identifier+'">Details of term "<span class="term-name-heading"></span>"</a> ';
details += (collapsed?'<a data-toggle="collapse" href="#collapse-'+identifier+'">Details of term "':'');
details += '<span class="term-name-heading"></span>';
details += (collapsed?'"</a> ':'');
// details += '<span class="label label-default bg-edam-'+branch_of_term+'-light border-one-solid fg-edam-'+branch_of_term+' border-edam-'+branch_of_term+'">'+branch_of_term+'</span>';
details += '<span>';
details += '<a title="edit this term" type="button" class="btn btn-default btn-xs pull-right" target="_blank" href="edit.html?term='+uri+'&branch='+current_branch+'"><span class="glyphicon glyphicon-pencil"></span></a>';
details += '<a title="add a child to this term" type="button" class="btn btn-default btn-xs pull-right" target="_blank" href="edit.html?parent='+uri+'&branch='+current_branch+'"><span class="glyphicon glyphicon-plus"></span></a>';
details += '</span>';
details += '</h4>';
details += '</div>';
details += '<div id="collapse-'+identifier+'" class="panel-collapse collapse">';
details += '<div id="collapse-'+identifier+'" '+(collapsed?'class="panel-collapse collapse">':'');
details += '<div class="panel-body border-edam-'+branch_of_term+'"><table class="table table-condensed xborder-edam-'+branch_of_term+'"><tbody class="details"></tbody></table><table class="table table-condensed xborder-edam-'+branch_of_term+'"><tbody class="community"></tbody></table></div>';
details += '</div>';
details += '</div>';
details += '</div>';
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();
Expand Down Expand Up @@ -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()){
Expand Down Expand Up @@ -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){
Expand Down

0 comments on commit 6199214

Please sign in to comment.