Bläddra i källkod

Index added to menubar

master
Dirk Alders 2 månader sedan
förälder
incheckning
fd5c50c662
1 ändrade filer med 16 tillägg och 3 borttagningar
  1. 16
    3
      pages/context.py

+ 16
- 3
pages/context.py Visa fil

@@ -22,6 +22,7 @@ ATTACHMENT_UID = 'attachment'
22 22
 BACK_UID = 'back'
23 23
 EDIT_UID = 'edit'
24 24
 HELP_UID = 'help'
25
+INDEX_UID = 'index'
25 26
 NAVIGATION_ENTRY_UID = 'navigation-%s'
26 27
 
27 28
 
@@ -81,18 +82,30 @@ def navigation_entry_parameters(request, path):
81 82
 def menubar(context, request, caller_name, **kwargs):
82 83
     bar = context[context.MENUBAR]
83 84
     menubar_users(bar, request)
84
-    add_help_menu(request, bar)
85
+    add_help_menu(request, bar, "current_help_page" in kwargs)
86
+    add_index_menu(request, bar, kwargs.get("rel_path", ''))
85 87
     finalise_bar(request, bar)
86 88
 
87 89
 
88
-def add_help_menu(request, bar):
90
+def add_help_menu(request, bar, active):
89 91
     bar.append_entry(
90 92
         HELP_UID,                                   # uid
91 93
         _('Help'),                                  # name
92 94
         color_icon_url(request, 'help.png'),        # icon
93 95
         pages.url_helpview(request, 'main'),        # url
94 96
         True,                                       # left
95
-        False                                       # active
97
+        active                                      # active
98
+    )
99
+
100
+
101
+def add_index_menu(request, bar, rel_path):
102
+    bar.append_entry(
103
+        INDEX_UID,                                  # uid
104
+        _('Index'),                                 # name
105
+        color_icon_url(request, 'info.png'),        # icon
106
+        pages.url_page(request, 'index'),           # url
107
+        True,                                       # left
108
+        request.path == "/page/index"               # active
96 109
     )
97 110
 
98 111
 

Laddar…
Avbryt
Spara