From fd5c50c66232b0e75481dca12fb967adb40e0c63 Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Mon, 7 Oct 2024 21:52:46 +0200 Subject: [PATCH] Index added to menubar --- pages/context.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pages/context.py b/pages/context.py index 775c8bb..b500716 100644 --- a/pages/context.py +++ b/pages/context.py @@ -22,6 +22,7 @@ ATTACHMENT_UID = 'attachment' BACK_UID = 'back' EDIT_UID = 'edit' HELP_UID = 'help' +INDEX_UID = 'index' NAVIGATION_ENTRY_UID = 'navigation-%s' @@ -81,18 +82,30 @@ def navigation_entry_parameters(request, path): def menubar(context, request, caller_name, **kwargs): bar = context[context.MENUBAR] menubar_users(bar, request) - add_help_menu(request, bar) + add_help_menu(request, bar, "current_help_page" in kwargs) + add_index_menu(request, bar, kwargs.get("rel_path", '')) finalise_bar(request, bar) -def add_help_menu(request, bar): +def add_help_menu(request, bar, active): bar.append_entry( HELP_UID, # uid _('Help'), # name color_icon_url(request, 'help.png'), # icon pages.url_helpview(request, 'main'), # url True, # left - False # active + active # active + ) + + +def add_index_menu(request, bar, rel_path): + bar.append_entry( + INDEX_UID, # uid + _('Index'), # name + color_icon_url(request, 'info.png'), # icon + pages.url_page(request, 'index'), # url + True, # left + request.path == "/page/index" # active )