Skip to content

Commit

Permalink
Add build_popover() for popover as suggested
Browse files Browse the repository at this point in the history
Uses a sub-function build_popover(<selector>) that selects a given
selector and initializes a popover for the given selector with its
container binding to the same selector passed.

Signed-off-by: Harshit Gupta <[email protected]>
  • Loading branch information
Git-Harshit committed Apr 11, 2024
1 parent 089b9b5 commit 4d12490
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/tree-edam-stand-alone.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ function interactive_edam_browser(){
append_detail_panel_to_edam_accordion(d, uri, branch_of_term, identifier, details);
}

function build_popover(selector){
$(selector).popover({container: selector});
}

function build_detail_panel (d, uri, branch_of_term, identifier, collapsed){
let details = "";
details += '<div class="panel-group edam-details" id="details-'+identifier+'">';
Expand Down Expand Up @@ -433,7 +437,7 @@ function interactive_edam_browser(){
});
}
}
$('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_b+' [data-toggle="popover"]'});
build_popover('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]');
});
}
var caller_s=biosphere_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d);
Expand All @@ -446,7 +450,7 @@ function interactive_edam_browser(){
to_biosphere_href(c[0],caller_s.get_url(),data[0]) + ' by appliances, ' +
to_biosphere_href(c[1],caller_s.get_url(),data[1]) + ' by tools.' +
'</span>').appendTo(elt);
$('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_s+' [data-toggle="popover"]'});
build_popover('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]');
});
}
var caller_w=bioweb_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d);
Expand All @@ -456,7 +460,7 @@ function interactive_edam_browser(){
var elt=$('#details-'+identifier+' .'+id_w);
elt.empty();
$(to_bioweb_href(c,caller_w.get_url(),data)).appendTo(elt);
$('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_w+' [data-toggle="popover"]'});
build_popover('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]');
});
}
var caller_t=tess_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d);
Expand All @@ -466,7 +470,7 @@ function interactive_edam_browser(){
var elt=$('#details-'+identifier+' .'+id_t);
elt.empty();
$(to_tess_href(c,caller_t.get_url(),data)).appendTo(elt);
$('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_t+' [data-toggle="popover"]'});
build_popover('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]');
});
}
if(uri.startsWith("http://edamontology.org/")){
Expand Down

0 comments on commit 4d12490

Please sign in to comment.