From 7c3c07a371de310215e416abaef3186436742e31 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 2 Jan 2024 19:21:07 +0000 Subject: Change the way the info button works so that it just submits a form instead of opening a window with JS --- .../static/new/javascript/dataset_select_menu_orig.js | 17 ++++++++++------- gn2/wqflask/templates/index_page.html | 7 +++---- gn2/wqflask/views.py | 9 +++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/gn2/wqflask/static/new/javascript/dataset_select_menu_orig.js b/gn2/wqflask/static/new/javascript/dataset_select_menu_orig.js index 25a703e6..f962cb41 100644 --- a/gn2/wqflask/static/new/javascript/dataset_select_menu_orig.js +++ b/gn2/wqflask/static/new/javascript/dataset_select_menu_orig.js @@ -260,17 +260,17 @@ group_info = function() { $('#group_info').click(group_info); dataset_info = function() { - var dataset, url; accession_id = $('#dataset option:selected').data("id"); if (accession_id != "None") { - url = "https://info.genenetwork.org/infofile/source.php?GN_AccesionId=" + accession_id + $('input[name=accession_id]').val(accession_id); } else { - species = $('#species').val(); - group = $('#group').val(); - url = "https://info.genenetwork.org/species/source.php?SpeciesName=" + species + "&InbredSetName=" + group + $('input[name=accession_id]').val("None"); } - return open_window(url, "_blank"); -}; + + $('#searchform').prop("action", "/db_info"); + $('#searchform').submit(); +} + $('#dataset_info').click(dataset_info); make_default = function() { @@ -328,3 +328,6 @@ check_search_term = function() { }; $("#make_default").click(make_default); +$("#btsearch").click(function() { + $("#searchform").prop("action", "/search") +}); diff --git a/gn2/wqflask/templates/index_page.html b/gn2/wqflask/templates/index_page.html index 7b5a1d16..a245b7f3 100755 --- a/gn2/wqflask/templates/index_page.html +++ b/gn2/wqflask/templates/index_page.html @@ -203,7 +203,7 @@
- + @@ -386,12 +386,11 @@ $(document).on('submit', '#searchform', function(event){ if( event.target.value.trim() != "" ) { saveBeforeSubmit(event.target.value.trim()) - $("#searchform")[0].submit(); - + $("#searchform").prop("action", "/search") + $("#searchform")[0].submit(); } } } - {% endblock %} diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py index 80199ecb..155769d6 100644 --- a/gn2/wqflask/views.py +++ b/gn2/wqflask/views.py @@ -1003,9 +1003,10 @@ def snp_browser_page(): @app.route("/db_info", methods=('GET',)) def db_info_page(): - template_vars = InfoPage(request.args) - - return render_template("info_page.html", **template_vars.__dict__) + if request.args['accession_id'] != "None" and not any(x in request.args['dataset'] for x in ["Publish", "Geno"]): + return redirect("https://info.genenetwork.org/infofile/source.php?GN_AccesionId=" + request.args['accession_id']) + else: + return redirect("https://info.genenetwork.org/species/source.php?SpeciesName=" + request.args['species'] + "&InbredSetName=" + request.args['group']) @app.route("/snp_browser_table", methods=('GET',)) @@ -1024,7 +1025,7 @@ def snp_browser_table(): @app.route("/tutorial/WebQTLTour", methods=('GET',)) def tutorial_page(): - # ZS: Currently just links to GN1 + # Currently just links to GN1 return redirect("http://gn1.genenetwork.org/tutorial/WebQTLTour/") -- cgit v1.2.3