Page links in navigationbar added
This commit is contained in:
parent
7f357e9a3a
commit
a293bc9eff
@ -1,5 +1,6 @@
|
|||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ ATTACHMENT_UID = 'attachment'
|
|||||||
BACK_UID = 'back'
|
BACK_UID = 'back'
|
||||||
EDIT_UID = 'edit'
|
EDIT_UID = 'edit'
|
||||||
HELP_UID = 'help'
|
HELP_UID = 'help'
|
||||||
|
NAVIGATION_ENTRY_UID = 'navigation-%s'
|
||||||
|
|
||||||
|
|
||||||
def context_adaption(context, request, **kwargs):
|
def context_adaption(context, request, **kwargs):
|
||||||
@ -40,8 +42,11 @@ def context_adaption(context, request, **kwargs):
|
|||||||
|
|
||||||
def navigationbar(context, request, caller_name, **kwargs):
|
def navigationbar(context, request, caller_name, **kwargs):
|
||||||
bar = context[context.NAVIGATIONBAR]
|
bar = context[context.NAVIGATIONBAR]
|
||||||
|
path = kwargs.get("rel_path")
|
||||||
|
while len(path) > 0 and path != os.path.sep:
|
||||||
|
bar.append_entry(*navigation_entry_parameters(request, path))
|
||||||
|
path = os.path.dirname(path)
|
||||||
add_back_menu(request, bar)
|
add_back_menu(request, bar)
|
||||||
# TODO: Add the pages navigation, if source is pages
|
|
||||||
finalise_bar(request, bar)
|
finalise_bar(request, bar)
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +61,17 @@ def add_back_menu(request, bar):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def navigation_entry_parameters(request, path):
|
||||||
|
return (
|
||||||
|
NAVIGATION_ENTRY_UID % os.path.basename(path), # uid
|
||||||
|
'/' + os.path.basename(path), # name
|
||||||
|
None, # icon
|
||||||
|
pages.url_page(request, path), # url
|
||||||
|
False, # left
|
||||||
|
False # active
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def menubar(context, request, caller_name, **kwargs):
|
def menubar(context, request, caller_name, **kwargs):
|
||||||
bar = context[context.MENUBAR]
|
bar = context[context.MENUBAR]
|
||||||
add_help_menu(request, bar)
|
add_help_menu(request, bar)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user