about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-09-06 17:57:57 +0300
committerBonfaceKilz2024-09-19 18:52:43 +0300
commita71f641bd893825c3d71fe55d09f40075336a345 (patch)
treee67b473056cf89426636c4f8b243fb0060547d75
parentadbd8b1a2fad59c95beb2d7ec2d2dec6165bb8d5 (diff)
downloadgenenetwork2-a71f641bd893825c3d71fe55d09f40075336a345.tar.gz
Add a page for searching GeneWiki by symbol.
* gn2/wqflask/templates/wiki/search.html: New template.
* gn2/wqflask/views.py (search_wiki): New end-point.

Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn2/wqflask/templates/wiki/search.html32
-rw-r--r--gn2/wqflask/views.py12
2 files changed, 44 insertions, 0 deletions
diff --git a/gn2/wqflask/templates/wiki/search.html b/gn2/wqflask/templates/wiki/search.html
new file mode 100644
index 00000000..863d3daa
--- /dev/null
+++ b/gn2/wqflask/templates/wiki/search.html
@@ -0,0 +1,32 @@
+{% extends "base.html" %}
+{% block content %}
+    <div class="container">
+        <div class="row">
+            <div class="col-md-9 col-md-offset-3">
+                <h1>
+                    <strong>GeneWiki Entries</strong>
+                </h1>
+                <p>
+                    GeneWiki enables you to enrich the annotation of genes and transcripts. Please submit or edit a GeneWiki note (500 characters max) related to a gene, its transcripts, or proteins. When possible include PubMed identifiers or web resource links (URL addresses). Please ensure that the additions will have widespread use. For additional information, check the GeneWiki <a href="https://gn1.genenetwork.org/GeneWikihelp.html" target="_blank">help document</a>.
+                </p>
+                <span id="helpBlock" class="help-block">Please enter a gene symbol in the box below and then click submit.</span>
+            </div>
+        </div>
+        <div class="row">
+            <form method="POST"
+                  class="form-inline col-md-9 col-md-offset-3"
+                  action="{{ url_for("search_wiki") }}">
+                <div class="form-group col-md-offset-2">
+                    <label for="search" class="sr-only">Search Symbol</label>
+                    <input name="search"
+                           type="text"
+                           class="form-control"
+                           id="search"
+                           placeholder="Search Symbol"
+                           aria-describeBy="helpBlock" />
+                </div>
+                <button type="submit" class="btn btn-primary">submit</button>
+            </form>
+        </div>
+    </div>
+{% endblock %}
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py
index d9c35115..6bd66940 100644
--- a/gn2/wqflask/views.py
+++ b/gn2/wqflask/views.py
@@ -1649,3 +1649,15 @@ def edit_wiki(comment_id: int):
 
         flash(f"Success: {post_res}", "alert-success")
         return redirect(url_for("edit_wiki", comment_id=comment_id))
+
+
+@app.route("/genewiki", methods=["POST", "GET"])
+def search_wiki():
+    """Search genewiki for a given symbol"""
+    if request.method == "GET":
+        return render_template(
+            "wiki/search.html",
+        )
+    return redirect(url_for(
+        "display_genewiki_page",
+        symbol=request.form.get("search")))