From 44d3ab8d7070317241f0348edcf57fb4c3b044ca Mon Sep 17 00:00:00 2001 From: John Nduli Date: Tue, 10 Sep 2024 15:38:15 +0300 Subject: feat: hide edit button if user isnt logged in --- gn2/wqflask/templates/wiki/genewiki.html | 6 ++++++ gn2/wqflask/views.py | 16 +++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'gn2') diff --git a/gn2/wqflask/templates/wiki/genewiki.html b/gn2/wqflask/templates/wiki/genewiki.html index 36aa41c1..f0d6675f 100644 --- a/gn2/wqflask/templates/wiki/genewiki.html +++ b/gn2/wqflask/templates/wiki/genewiki.html @@ -11,7 +11,9 @@
GeneNetwork:
+ {% if wiki %} +
    {% for entry in wiki %}
  1. @@ -23,12 +25,16 @@ web {% endif %} + + {% if is_logged_in %} + {% endif %} [history] +
  2. {% endfor %}
diff --git a/gn2/wqflask/views.py b/gn2/wqflask/views.py index ec2854c4..5c856b77 100644 --- a/gn2/wqflask/views.py +++ b/gn2/wqflask/views.py @@ -1301,21 +1301,15 @@ def display_genewiki_page(symbol: str): """Fetch GeneRIF metadata from GN3 and display it""" wiki = {} try: - wiki = requests.get( - urljoin( - GN3_LOCAL_URL, - f"/api/metadata/wiki/{symbol}" - ) - ) + wiki = requests.get(urljoin(GN3_LOCAL_URL, f"/api/metadata/wiki/{symbol}")) wiki.raise_for_status() wiki = wiki.json() except requests.RequestException as excp: flash(excp, "alert-warning") - return render_template( - "wiki/genewiki.html", - symbol=symbol, - wiki=wiki - ) + sess_info = session_info() + is_logged_in = sess_info.get("user", {}).get("logged_in", False) + + return render_template("wiki/genewiki.html", symbol=symbol, wiki=wiki, is_logged_in=is_logged_in) @app.route("/genewiki//history") -- cgit v1.2.3