From 9ad8058597a89adafebeee2335588b5c575320be Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 16 Oct 2017 17:04:52 +0200 Subject: [PATCH] main navigation header links now based on resource urls --- ordr2/resources/__init__.py | 5 ++++ ordr2/templates/layout.jinja2 | 52 +++++++++++++++++++++-------------- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/ordr2/resources/__init__.py b/ordr2/resources/__init__.py index b1455e3..784869c 100644 --- a/ordr2/resources/__init__.py +++ b/ordr2/resources/__init__.py @@ -31,6 +31,9 @@ class BaseResource(object): __name__ = None __parent__ = None + #: name of the main nav_section for template highlighting + nav_section = None + #: dict to match the next url path segment nodes = {} @@ -66,6 +69,8 @@ class RootResource(BaseResource): pyramid.request.Request ''' + nav_section = 'root' + def __init__(self, request): ''' Create the root resource ''' self.__name__ = None diff --git a/ordr2/templates/layout.jinja2 b/ordr2/templates/layout.jinja2 index 735149d..795c4b0 100644 --- a/ordr2/templates/layout.jinja2 +++ b/ordr2/templates/layout.jinja2 @@ -26,27 +26,39 @@ ordr - - + {% if request.user %} + - - + + + + + + {% else %} + + + + + {% endif %}