about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzsloan2024-01-02 19:21:07 +0000
committerzsloan2024-01-02 19:21:37 +0000
commit7c3c07a371de310215e416abaef3186436742e31 (patch)
treedf37c75ecfe28672dd31356978760926767002a0
parentecb83c962536bffe468767597da76b25c813be64 (diff)
downloadgenenetwork2-7c3c07a371de310215e416abaef3186436742e31.tar.gz
Change the way the info button works so that it just submits a form instead of opening a window with JS
-rw-r--r--gn2/wqflask/static/new/javascript/dataset_select_menu_orig.js17
-rwxr-xr-xgn2/wqflask/templates/index_page.html7
-rw-r--r--gn2/wqflask/views.py9
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 @@
                                 <!--  SEARCH, MAKE DEFAULT -->
                                 <div class="form-group">
                                 </div>
-
+                                <input type="hidden" name="accession_id" value="None" class="form-control">
                                 <input type="hidden" name="FormID" value="searchResult" class="form-control">
                             </div>
                         </fieldset>
@@ -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();
                 }
                 
             }
         }
-
     </script>
 {% 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/")