Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update popover() method to prevent its untimely dismissal #227

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions js/tree-edam-stand-alone.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ function interactive_edam_browser(){
return data.next != null;
}

function to_biotools_href(c,url,data){
return to_generic_href(c,url,data,get_length_biotools,get_name_biotools,has_next_biotools);
function to_biotools_href(c,url,data,css_classes=""){
return to_generic_href(c,url,data,css_classes,get_length_biotools,get_name_biotools,has_next_biotools);
}

function get_length_default(data){
Expand All @@ -233,31 +233,32 @@ function interactive_edam_browser(){
return false;
}

function to_tess_href(c,url,data){
return to_generic_href(c,url,data,get_length_default,get_name_tess,has_next_default);
function to_tess_href(c,url,data,css_classes=""){
return to_generic_href(c,url,data,css_classes,get_length_default,get_name_tess,has_next_default);
}

function to_biosphere_href(c,url,data){
return to_generic_href(c,url,data,get_length_default,get_name_default,has_next_default);
function to_biosphere_href(c,url,data,css_classes=""){
return to_generic_href(c,url,data,css_classes,get_length_default,get_name_default,has_next_default);
}

function get_name_bioweb(data, i){
return data[i].name;
}

function to_bioweb_href(c,url,data){
return to_generic_href(c,url,data,get_length_default,get_name_bioweb,has_next_default);
function to_bioweb_href(c,url,data,css_classes=""){
return to_generic_href(c,url,data,css_classes,get_length_default,get_name_bioweb,has_next_default);
}

function to_generic_href(c,url,data, get_length, get_name, has_next){
function to_generic_href(c, url, data, css_classes, get_length, get_name, has_next){
var data_content="";
let msg;
if(c>0){
data_content = "title=\"Some associated elements\""
data_content += "data-toggle=\"popover\""
data_content += "data-placement=\"auto right\""
data_content += "data-trigger=\"hover\""
data_content += "data-trigger=\"hover focus\""
data_content += "data-html=\"true\""
data_content += `class="${css_classes}"`
data_content += "data-content=\"<table class=' table table-condensed'>";
var i=0;
for(;i<get_length(data)&&i<10;i++){
Expand Down Expand Up @@ -303,6 +304,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 +438,7 @@ function interactive_edam_browser(){
});
}
}
$('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]').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 @@ -443,10 +448,11 @@ function interactive_edam_browser(){
var elt=$('#details-'+identifier+' .'+id_s);
elt.empty();
$('<span>' +
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.' +
to_biosphere_href(c[0],caller_s.get_url(),data[0],'app') + ' by appliances, ' +
to_biosphere_href(c[1],caller_s.get_url(),data[1],'tool') + ' by tools.' +
'</span>').appendTo(elt);
$('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]').popover();
build_popover('#details-'+identifier+' .'+id_s+' [data-toggle="popover"].app');
build_popover('#details-'+identifier+' .'+id_s+' [data-toggle="popover"].tool');
});
}
var caller_w=bioweb_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d);
Expand All @@ -456,7 +462,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();
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 +472,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();
build_popover('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]');
});
}
if(uri.startsWith("http://edamontology.org/")){
Expand Down