From f6a3d64dd26f14a535a17724b773f151c4430366 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Tue, 24 Oct 2023 20:37:32 +0700 Subject: [PATCH] Manage menu on template --- config/globalvar.py | 18 ++++++++++++++++++ modules/user/home.py | 6 ++++++ static/template/topnav.html | 26 +++++++++++++++----------- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/config/globalvar.py b/config/globalvar.py index 3fbd038..6b1563b 100755 --- a/config/globalvar.py +++ b/config/globalvar.py @@ -1,3 +1,21 @@ # Your global variables GV_base_url = "http://localhost:81" GV_title = "CostaPy" + +GV_menu_navbar = [ + { + "name":"Home", + "href":"/", + "roles":["guest"] + }, + { + "name":"About", + "href":"#", + "roles":["guest"] + }, + { + "name":"CostaPy Website", + "href":"https://costapy.ditaajipratama.com", + "roles":["guest"] + } +] diff --git a/modules/user/home.py b/modules/user/home.py index ac4d1a3..d7d3c4f 100644 --- a/modules/user/home.py +++ b/modules/user/home.py @@ -20,11 +20,17 @@ class main: name = "World" + user_roles = ["guest"] + active_page = "Home" + return Template(interface_template).render( GV_title = globalvar.GV_title, GV_base_url = globalvar.GV_base_url, topnav = Template(topnav).render( GV_title = globalvar.GV_title, + menu = globalvar.GV_menu_navbar, + user_roles = user_roles, + active_page = active_page ), footer = Template(footer).render( copyright_holder = "Dita Aji Pratama", diff --git a/static/template/topnav.html b/static/template/topnav.html index f05ff90..5313350 100755 --- a/static/template/topnav.html +++ b/static/template/topnav.html @@ -1,13 +1,17 @@