This is an automated email from the ASF dual-hosted git repository.

gstein pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git

commit b92922dcb571709fe47baa9bf0263bd03bd72926
Author: Greg Stein <[email protected]>
AuthorDate: Mon Oct 6 11:14:50 2025 -0500

    Add an Election management page.
---
 v3/server/pages.py                                | 28 +++++++++++++++++++++++
 v3/server/templates/e_bad_eid.ezt                 |  5 +++-
 v3/server/templates/{e_bad_eid.ezt => manage.ezt} |  3 +--
 3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/v3/server/pages.py b/v3/server/pages.py
index c36483d..23475b5 100644
--- a/v3/server/pages.py
+++ b/v3/server/pages.py
@@ -139,6 +139,34 @@ async def admin_page():
     return result
 
 
[email protected]('/manage/<eid>')
[email protected]({R.committer})  ### need general solution
[email protected]_template(TEMPLATES / 'manage.ezt')
+async def manage_page(eid):
+    result = await signin_info()
+    result.title = 'Manage an Election'
+
+    e = steve.election.Election(DB_FNAME, eid)
+
+    try:
+        md = e.get_metadata()
+    except AttributeError:
+        # If the EID is wrong, the fetch fails trying to access metadata.
+        ### YES, very poor way to signal a bad EID. fix this.
+        result.title = 'Unknown Election'
+        result.eid = eid
+        # Note: result.uid (and friends) are needed for the navbar.
+        raise_404(T_BAD_EID, result)
+        # NOTREACHED
+
+    ### check authz
+
+    ### rando for now. fetch the issues, and put in a count.
+    result.issue_count = 7
+
+    return result
+
+
 @APP.get('/profile')
 @asfquart.auth.require  # Bare decorator means just require a valid session
 @APP.use_template(TEMPLATES / 'profile.ezt')
diff --git a/v3/server/templates/e_bad_eid.ezt 
b/v3/server/templates/e_bad_eid.ezt
index 5beb3b8..50c8dbc 100644
--- a/v3/server/templates/e_bad_eid.ezt
+++ b/v3/server/templates/e_bad_eid.ezt
@@ -2,8 +2,11 @@
     <div class="container">
         <h1>[title]</h1>
         <p>
+            [# we could be more specific. simpler to re-use. ]
+
             The Election ID ([eid]) does not exist,
-            or you have no issues to vote in that Election.
+            you have no issues to vote in that Election,
+            or you are not allowed to manage that Election.
         </p>
     </div>
 [include "footer.ezt"]
diff --git a/v3/server/templates/e_bad_eid.ezt b/v3/server/templates/manage.ezt
similarity index 54%
copy from v3/server/templates/e_bad_eid.ezt
copy to v3/server/templates/manage.ezt
index 5beb3b8..fca18eb 100644
--- a/v3/server/templates/e_bad_eid.ezt
+++ b/v3/server/templates/manage.ezt
@@ -2,8 +2,7 @@
     <div class="container">
         <h1>[title]</h1>
         <p>
-            The Election ID ([eid]) does not exist,
-            or you have no issues to vote in that Election.
+            TBD: manage
         </p>
     </div>
 [include "footer.ezt"]

Reply via email to