From 455094ca60abc948a3ff0d62c74cbc0d157892d6 Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Sat, 22 Aug 2026 21:05:25 +0100 Subject: [PATCH 01/10] move home to separate directories --- biosimdb_interface/__init__.py | 4 ++++ biosimdb_interface/form/__init__.py | 2 +- biosimdb_interface/home/__init__.py | 6 ++++++ biosimdb_interface/{form => home}/home.py | 6 +++--- biosimdb_interface/templates/{main => home}/home.html | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 biosimdb_interface/home/__init__.py rename biosimdb_interface/{form => home}/home.py (92%) rename biosimdb_interface/templates/{main => home}/home.html (99%) diff --git a/biosimdb_interface/__init__.py b/biosimdb_interface/__init__.py index 582900e..29919b0 100644 --- a/biosimdb_interface/__init__.py +++ b/biosimdb_interface/__init__.py @@ -86,4 +86,8 @@ def inject_base_url(): app.register_blueprint(login_bp, url_prefix=app.config["APPLICATION_BASE"]) + from .home import home_bp + + app.register_blueprint(home_bp, url_prefix=app.config["APPLICATION_BASE"]) + return app diff --git a/biosimdb_interface/form/__init__.py b/biosimdb_interface/form/__init__.py index 498f6e5..9489b44 100644 --- a/biosimdb_interface/form/__init__.py +++ b/biosimdb_interface/form/__init__.py @@ -3,4 +3,4 @@ form_bp = Blueprint("form", __name__) -from . import extract, home, webform # noqa: E402, F401 +from . import extract, webform # noqa: E402, F401 diff --git a/biosimdb_interface/home/__init__.py b/biosimdb_interface/home/__init__.py new file mode 100644 index 0000000..16cd87e --- /dev/null +++ b/biosimdb_interface/home/__init__.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python +from flask import Blueprint + +home_bp = Blueprint("home", __name__) + +from . import home # noqa: E402, F401 diff --git a/biosimdb_interface/form/home.py b/biosimdb_interface/home/home.py similarity index 92% rename from biosimdb_interface/form/home.py rename to biosimdb_interface/home/home.py index f7f4e4a..e83256c 100644 --- a/biosimdb_interface/form/home.py +++ b/biosimdb_interface/home/home.py @@ -9,14 +9,14 @@ url_for, ) -from . import form_bp +from ..home import home_bp -@form_bp.route("/", methods=["GET"]) +@home_bp.route("/", methods=["GET"]) def home(): """Landing page with BioSimDB overview and quick links.""" return render_template( - "main/home.html", + "home/home.html", links={ "deposit": url_for("form.webform"), "biosimdb": f"{current_app.config.get('BASE_URL', '').rstrip('/')}/communities/biosimdb", diff --git a/biosimdb_interface/templates/main/home.html b/biosimdb_interface/templates/home/home.html similarity index 99% rename from biosimdb_interface/templates/main/home.html rename to biosimdb_interface/templates/home/home.html index 63d0806..99da6f8 100644 --- a/biosimdb_interface/templates/main/home.html +++ b/biosimdb_interface/templates/home/home.html @@ -31,7 +31,7 @@
From a5dba475a9c991f3dc3ca9de4465da22df2f2949 Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Sat, 22 Aug 2026 22:00:29 +0100 Subject: [PATCH 02/10] remove automatic redirect once record is created and add a button to go back to webform --- .../templates/form/submit_success.html | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/biosimdb_interface/templates/form/submit_success.html b/biosimdb_interface/templates/form/submit_success.html index 1a4a7c6..4b4b7ee 100644 --- a/biosimdb_interface/templates/form/submit_success.html +++ b/biosimdb_interface/templates/form/submit_success.html @@ -15,10 +15,9 @@ {% block content %} {% endblock %} @@ -30,20 +29,5 @@ sessionStorage.removeItem('formState'); sessionStorage.removeItem('extractedMetadata'); }); - - let seconds = 10; - const countdown = document.getElementById('countdown'); - const interval = setInterval(() => { - seconds--; - countdown.textContent = seconds; - if (seconds <= 0) { - clearInterval(interval); - const win = window.open('{{ record_url }}', '_blank', 'noopener,noreferrer'); - if (!win) { - // Fallback if popup was blocked - window.location = '{{ record_url }}'; - } - } - }, 1000); {% endblock %} From c2ad97b02d5d915708419fd45425c26d5d50d41e Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Sat, 22 Aug 2026 22:13:06 +0100 Subject: [PATCH 03/10] add cancel button when submitting data to Invenio, retun back to empty form --- .../templates/form/loading.html | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/biosimdb_interface/templates/form/loading.html b/biosimdb_interface/templates/form/loading.html index e7ef060..480e0b5 100644 --- a/biosimdb_interface/templates/form/loading.html +++ b/biosimdb_interface/templates/form/loading.html @@ -3,22 +3,43 @@ Intermediate page shown while a BioSimDB submission is in progress. Behaviour: - - Displays a spinner while an invisible form auto-submits via POST to form.do_submit. - - The hidden form carries the session cookie so the server can retrieve the pending submission. - - On completion, the server redirects to submit_success.html. + - Submits to form.do_submit via fetch so it can be cancelled client-side. + - On completion, navigates to the final response URL (success or webform). + - Cancel aborts the fetch and resets session state via form.cancel_submit. #} {% extends "main/base.html" %} {% block content %}

Submitting to BioSimDB, please wait...

+
- {% endblock %} {% block scripts %} {{ super() }} {% endblock %} From f3bcbbc61e0b5bc95a382518c9aa83490d87c971 Mon Sep 17 00:00:00 2001 From: Jas Kalayan Date: Sat, 22 Aug 2026 22:15:19 +0100 Subject: [PATCH 04/10] update link to home.home, add state for clearing form fields --- biosimdb_interface/templates/form/webform.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/biosimdb_interface/templates/form/webform.html b/biosimdb_interface/templates/form/webform.html index d4e6c86..bfed4bc 100644 --- a/biosimdb_interface/templates/form/webform.html +++ b/biosimdb_interface/templates/form/webform.html @@ -98,7 +98,7 @@
@@ -350,6 +350,10 @@

{% block scripts %} {{ super() }} + +