From ab9a4a21e4b5a815b9c6dfd465d54e6df27d7364 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 29 Dec 2025 10:48:53 -0600 Subject: Publications: Move feature to new UI templates. --- uploader/publications/views.py | 14 +- uploader/templates/publications/base.html | 13 +- .../templates/publications/create-publication.html | 23 ++- .../templates/publications/delete-publication.html | 11 +- .../templates/publications/edit-publication.html | 13 +- uploader/templates/publications/index.html | 57 +++--- uploader/templates/publications/sui-base.html | 9 - .../publications/sui-create-publication.html | 200 -------------------- .../publications/sui-delete-publication.html | 95 ---------- .../publications/sui-edit-publication.html | 203 --------------------- uploader/templates/publications/sui-index.html | 109 ----------- .../publications/sui-view-publication.html | 80 -------- .../templates/publications/view-publication.html | 2 - 13 files changed, 79 insertions(+), 750 deletions(-) delete mode 100644 uploader/templates/publications/sui-base.html delete mode 100644 uploader/templates/publications/sui-create-publication.html delete mode 100644 uploader/templates/publications/sui-delete-publication.html delete mode 100644 uploader/templates/publications/sui-edit-publication.html delete mode 100644 uploader/templates/publications/sui-index.html delete mode 100644 uploader/templates/publications/sui-view-publication.html diff --git a/uploader/publications/views.py b/uploader/publications/views.py index 11732db..d9eb294 100644 --- a/uploader/publications/views.py +++ b/uploader/publications/views.py @@ -10,8 +10,6 @@ from flask import ( render_template, current_app as app) -from uploader.sui import sui_template - from uploader.flask_extensions import url_for from uploader.authorisation import require_login from uploader.route_utils import redirect_to_next @@ -32,7 +30,7 @@ pubbp = Blueprint("publications", __name__) @require_login def index(): """Index page for publications.""" - return render_template(sui_template("publications/index.html")) + return render_template("publications/index.html") @pubbp.route("/list", methods=["GET"]) @@ -74,7 +72,7 @@ def view_publication(publication_id: int): return redirect(url_for('publications.index')) return render_template( - sui_template("publications/view-publication.html"), + "publications/view-publication.html", publication=publication, linked_phenotypes=tuple(fetch_publication_phenotypes( conn, publication_id))) @@ -92,7 +90,7 @@ def create_publication(): if request.method == "GET": return render_template( - sui_template("publications/create-publication.html"), + "publications/create-publication.html", get_args=_get_args) form = request.form authors = form.get("publication-authors").encode("utf8") @@ -130,7 +128,7 @@ def edit_publication(publication_id: int): with database_connection(app.config["SQL_URI"]) as conn: if request.method == "GET": return render_template( - sui_template("publications/edit-publication.html"), + "publications/edit-publication.html", publication=fetch_publication_by_id(conn, publication_id), linked_phenotypes=tuple(fetch_publication_phenotypes( conn, publication_id)), @@ -181,12 +179,12 @@ def delete_publication(publication_id: int): flash("Cannot delete publication with linked phenotypes!", "alert-warning") return redirect(url_for( - sui_template("publications.view_publication"), + "publications.view_publication", publication_id=publication_id)) if request.method == "GET": return render_template( - sui_template("publications/delete-publication.html"), + "publications/delete-publication.html", publication=publication, linked_phenotypes=linked_phenotypes, publication_id=publication_id) diff --git a/uploader/templates/publications/base.html b/uploader/templates/publications/base.html index db80bfa..de0a350 100644 --- a/uploader/templates/publications/base.html +++ b/uploader/templates/publications/base.html @@ -1,12 +1,9 @@ {%extends "base.html"%} -{%block lvl1_breadcrumbs%} -
Click on title to view more details and to edit details for that + publication.
You are about to delete the publication with the following details:
-| Linked Phenotypes | -{{linked_phenotypes | count}} | -
|---|---|
| PubMed | -- {%if publication.PubMed_ID%} - {{publication.PubMed_ID}} - {%else%} - — - {%endif%} - | -
| Title | -{{publication.Title or "—"}} | -
| Authors | -{{publication.Authors or "—"}} | -
| Journal | -{{publication.Journal or "—"}} | -
| Published | -{{publication.Month or ""}} {{publication.Year or "—"}} | -
| Volume | -{{publication.Volume or "—"}} | -
| Pages | -{{publication.Pages or "—"}} | -
| Abstract | -
- {%for line in (publication.Abstract or "—").replace("\r\n", " ").replace("\n", " ").split(" ")%} - {{line}} - {%endfor%} - |
-
If you are sure that is what you want, click the button below to delete the - publication
-- You will not be able to recover the data if you click - delete below.
- - -Click on title to view more details and to edit details for that - publication.
-| # | -PubMed ID | -Title | -Authors | -
|---|
| Linked Phenotypes | -{{linked_phenotypes | count}} | -
|---|---|
| PubMed | -- {%if publication.PubMed_ID%} - {{publication.PubMed_ID}} - {%else%} - — - {%endif%} - | -
| Title | -{{publication.Title or "—"}} | -
| Authors | -{{publication.Authors or "—"}} | -
| Journal | -{{publication.Journal or "—"}} | -
| Published | -{{publication.Month or ""}} {{publication.Year or "—"}} | -
| Volume | -{{publication.Volume or "—"}} | -
| Pages | -{{publication.Pages or "—"}} | -
| Abstract | -
- {%for line in (publication.Abstract or "—").replace("\r\n", " ").replace("\n", " ").split(" ")%} - {{line}} - {%endfor%} - |
-