From 373169f3fa7682f8d260080a39261fc6216b9a21 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 23 Mar 2017 18:50:31 +0100 Subject: UI: use the url to detect the current action (more accurate) (refs #3357) --- ishtar_common/context_processors.py | 3 ++- ishtar_common/templates/base.html | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/context_processors.py b/ishtar_common/context_processors.py index 8e14d8506..5050d667e 100644 --- a/ishtar_common/context_processors.py +++ b/ishtar_common/context_processors.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2013 Étienne Loks +# Copyright (C) 2010-2017 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -44,6 +44,7 @@ def get_base_context(request): if 'CURRENT_ACTION' in request.session: dct['CURRENT_ACTION'] = request.session['CURRENT_ACTION'] current_action = dct['CURRENT_ACTION'] + dct['CURRENT_PATH'] = request.path menu = Menu(request.user, current_action=current_action, session=request.session) menu.init() diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 614a83595..b20cb1ccb 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -90,15 +90,18 @@
  • {{section.label}}
      - {% for menu_item in section.childs %}{%if menu_item.available%} - {% if menu_item.childs %}
    • {{menu_item.label}} + {% for menu_item in section.childs %}{%if menu_item.available%} + {% if menu_item.childs %}
    • {{menu_item.label}}
        - {% for menu_subitem in menu_item.childs %}{%if menu_subitem.available%} -
      • {{menu_subitem.label}}
      • + {% for menu_subitem in menu_item.childs %}{% if menu_subitem.available %} + {% url 'action' menu_subitem.idx as item_url %} +
      • {{menu_subitem.label}}
      • {%endif%}{% endfor %}
    • - {%else%} + {% else %} + {% url 'action' menu_item.idx as item_url %} + class="{% if item_url in CURRENT_PATH %}selected{% endif %} {% if menu_item.css %}{{menu_item.css}}{% endif %}">{{menu_item.label}} {%endif%}{% endif %}{% endfor %}
  • {%endif%} -- cgit v1.2.3