diff libervia/web/server/pages.py @ 1618:5d9889f14012 default tip @

server: start major redesign - Add icons to menu items - Switch menu items representation from tuple to dictionary for future extensibility: - Include icon information - Prepare for additional data - Remove "login" from main menu, add login page URL to template data, as it is now a separate right-aligned item
author Goffi <goffi@goffi.org>
date Sat, 26 Oct 2024 23:07:01 +0200
parents 97ea776df74c
children
line wrap: on
line diff
--- a/libervia/web/server/pages.py	Wed Aug 07 00:02:40 2024 +0200
+++ b/libervia/web/server/pages.py	Sat Oct 26 23:07:01 2024 +0200
@@ -267,6 +267,10 @@
         return self.vhost_root.main_menu
 
     @property
+    def login_url(self):
+        return self.vhost_root.login_url
+
+    @property
     def default_theme(self):
         return self.vhost_root.default_theme
 
@@ -1421,7 +1425,7 @@
         uri = request.uri.decode()
         try:
             template_data["current_page"] = next(
-                m[0] for m in self.main_menu if uri.startswith(m[1])
+                m["name"] for m in self.main_menu if uri.startswith(m["url"])
             )
         except StopIteration:
             pass
@@ -1687,7 +1691,8 @@
                 "csrf_token": "" if profile is None else session_data.csrf_token,
                 "session_uuid": "public" if profile is None else session_data.uuid,
                 "breadcrumbs": [],
-                "tz_name": time.tzname[0]
+                "tz_name": time.tzname[0],
+                "login_url": self.login_url
             }
 
             # XXX: here is the code which need to be executed once