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%} - -{%block lvl2_breadcrumbs%}{%endblock%} {%endblock%} diff --git a/uploader/templates/publications/create-publication.html b/uploader/templates/publications/create-publication.html index 3f828a9..fb0127d 100644 --- a/uploader/templates/publications/create-publication.html +++ b/uploader/templates/publications/create-publication.html @@ -3,7 +3,13 @@ {%block title%}View Publication{%endblock%} -{%block pagetitle%}View Publication{%endblock%} +{%block breadcrumbs%} +{{super()}} + +{%endblock%} {%block contents%} @@ -12,7 +18,7 @@
@@ -152,11 +158,14 @@
-
-
-
- - +
+
+ +
+
+
diff --git a/uploader/templates/publications/delete-publication.html b/uploader/templates/publications/delete-publication.html index 0ac93ec..a9c8c7c 100644 --- a/uploader/templates/publications/delete-publication.html +++ b/uploader/templates/publications/delete-publication.html @@ -1,9 +1,16 @@ {%extends "publications/base.html"%} {%from "flash_messages.html" import flash_all_messages%} -{%block title%}View Publication{%endblock%} +{%block title%}Delete Publication{%endblock%} -{%block pagetitle%}View Publication{%endblock%} +{%block breadcrumbs%} +{{super()}} + +{%endblock%} {%block contents%} diff --git a/uploader/templates/publications/edit-publication.html b/uploader/templates/publications/edit-publication.html index 97fa134..314a78c 100644 --- a/uploader/templates/publications/edit-publication.html +++ b/uploader/templates/publications/edit-publication.html @@ -1,9 +1,16 @@ {%extends "publications/base.html"%} {%from "flash_messages.html" import flash_all_messages%} -{%block title%}View Publication{%endblock%} - -{%block pagetitle%}View Publication{%endblock%} +{%block title%}Edit Publication{%endblock%} + +{%block breadcrumbs%} +{{super()}} + +{%endblock%} {%block contents%} diff --git a/uploader/templates/publications/index.html b/uploader/templates/publications/index.html index 369812b..54d3fc0 100644 --- a/uploader/templates/publications/index.html +++ b/uploader/templates/publications/index.html @@ -3,16 +3,22 @@ {%block title%}Publications{%endblock%} -{%block pagetitle%}Publications{%endblock%} - {%block contents%} {{flash_all_messages()}} + +
+

Click on title to view more details and to edit details for that + publication.

@@ -33,6 +39,8 @@ {%block javascript%} + + - -{%endblock%} diff --git a/uploader/templates/publications/sui-delete-publication.html b/uploader/templates/publications/sui-delete-publication.html deleted file mode 100644 index 436f2c1..0000000 --- a/uploader/templates/publications/sui-delete-publication.html +++ /dev/null @@ -1,95 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Delete Publication{%endblock%} - -{%block breadcrumbs%} -{{super()}} - -{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} -
-

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.

- - -
- -
- -
-{%endblock%} - - -{%block javascript%} - -{%endblock%} diff --git a/uploader/templates/publications/sui-edit-publication.html b/uploader/templates/publications/sui-edit-publication.html deleted file mode 100644 index 847b020..0000000 --- a/uploader/templates/publications/sui-edit-publication.html +++ /dev/null @@ -1,203 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Edit Publication{%endblock%} - -{%block breadcrumbs%} -{{super()}} - -{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} - -
-
- -
- -
-
- -
- -
-
- - - This is the publication's ID on - NCBI's Pubmed Service - -
-
- -
- -
- - Provide the publication's title here. -
-
- -
- -
- - - A publication MUST have an author. You must - provide a value for the authors field. - -
-
- -
- -
- - Provide the name journal where the - publication was done, here. -
-
- -
- -
- - Month of publication -
- - -
- - Year of publication -
-
- -
- -
- - Journal volume -
- - -
- - Journal pages for the publication -
-
- -
- -
- -
-
- -
-
-
- - -
-
- -
-
- -{%endblock%} - - -{%block javascript%} - - -{%endblock%} diff --git a/uploader/templates/publications/sui-index.html b/uploader/templates/publications/sui-index.html deleted file mode 100644 index e405dd1..0000000 --- a/uploader/templates/publications/sui-index.html +++ /dev/null @@ -1,109 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}Publications{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} - - - -
-

Click on title to view more details and to edit details for that - publication.

-
- -
- - - - - - - - - - - -
#PubMed IDTitleAuthors
-
-{%endblock%} - - -{%block javascript%} - - - -{%endblock%} diff --git a/uploader/templates/publications/sui-view-publication.html b/uploader/templates/publications/sui-view-publication.html deleted file mode 100644 index 740fc37..0000000 --- a/uploader/templates/publications/sui-view-publication.html +++ /dev/null @@ -1,80 +0,0 @@ -{%extends "publications/sui-base.html"%} -{%from "flash_messages.html" import flash_all_messages%} - -{%block title%}View Publication{%endblock%} - - -{%block contents%} -{{flash_all_messages()}} - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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%} -
-
- -
-
- Edit - {%if linked_phenotypes | length == 0%} - delete - {%endif%} -
-
-{%endblock%} - - -{%block javascript%} - -{%endblock%} diff --git a/uploader/templates/publications/view-publication.html b/uploader/templates/publications/view-publication.html index 0bd7bc5..01ccf1e 100644 --- a/uploader/templates/publications/view-publication.html +++ b/uploader/templates/publications/view-publication.html @@ -3,8 +3,6 @@ {%block title%}View Publication{%endblock%} -{%block pagetitle%}View Publication{%endblock%} - {%block contents%} {{flash_all_messages()}} -- cgit 1.4.1