From 9c6ea533987f1935eb54d6591133df3bd96d2523 Mon Sep 17 00:00:00 2001 From: Jur Erick Date: Tue, 25 Feb 2025 22:09:12 +0800 Subject: [PATCH] - pass page param to Contact model of /contacts handler - added aria attribute to archive progress ui - htmx attributes update in edit - add loadMore block in index page - add sweetalert script & sweeConfirm function --- app.py | 6 +-- templates/archive_ui.html | 25 ++++++----- templates/edit.html | 12 ++++-- templates/index.html | 89 ++++++++++++++++++++++----------------- templates/layout.html | 11 +++++ templates/new.html | 2 +- 6 files changed, 90 insertions(+), 55 deletions(-) diff --git a/app.py b/app.py index 201eb47..b1a34f6 100644 --- a/app.py +++ b/app.py @@ -29,8 +29,8 @@ def contacts(): if request.headers.get('HX-Trigger') == 'search': return render_template("rows.html", contacts=contacts_set) else: - contacts_set = Contact.all() - return render_template("index.html", contacts=contacts_set, archiver=Archiver.get()) + contacts_set = Contact.all(page) + return render_template("index.html", contacts=contacts_set, page=page, archiver=Archiver.get()) @app.route("/contacts/archive", methods=["POST"]) @@ -130,7 +130,7 @@ def contacts_delete_all(): contact = Contact.find(contact_id) contact.delete() flash("Deleted Contacts!") - contacts_set = Contact.all(1) + contacts_set = Contact.all() return render_template("index.html", contacts=contacts_set) diff --git a/templates/archive_ui.html b/templates/archive_ui.html index 430d8c7..4461362 100644 --- a/templates/archive_ui.html +++ b/templates/archive_ui.html @@ -1,17 +1,22 @@
{% if archiver.status() == "Waiting" %} - + {% elif archiver.status() == "Running" %} -
- Creating Archive... -
-
-
+
+ Creating Archive... +
+
+
{% elif archiver.status() == "Complete" %} - Archive Downloading! Click here if the download does not start. - + Archive Ready! Click here if the download does not start. + {% endif %}
\ No newline at end of file diff --git a/templates/edit.html b/templates/edit.html index fd7ac84..6e16d13 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -10,7 +10,7 @@ {{ contact.errors['email'] }}

@@ -37,10 +37,16 @@ diff --git a/templates/index.html b/templates/index.html index e02c400..bccd15b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,61 +2,74 @@ {% block content %} - {% include 'archive_ui.html' %} +{% include 'archive_ui.html' %} -
- - - - -
+
+ + + + +
-
-