Commit 162ea8e6 authored by Serge S. Koval's avatar Serge S. Koval

Extend template to allow different menu hierarchies

parent f0b6cc20
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro menu() %} {% macro menu(menu_root=None) %}
{%- for item in admin_view.admin.menu() %} {% if menu_root is none %}{% set menu_root = admin_view.admin.menu() %}{% endif %}
{%- for item in menu_root %}
{%- if item.is_category() -%} {%- if item.is_category() -%}
{% set children = item.get_children() %} {% set children = item.get_children() %}
{%- if children %} {%- if children %}
...@@ -57,8 +58,9 @@ ...@@ -57,8 +58,9 @@
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro menu_links() %} {% macro menu_links(links=None) %}
{% for item in admin_view.admin.menu_links() %} {% if links is none %}{% set links = admin_view.admin.menu_links() %}{% endif %}
{% for item in links %}
{% if item.is_accessible() and item.is_visible() %} {% if item.is_accessible() and item.is_visible() %}
<li> <li>
<a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a> <a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a>
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro menu() %} {% macro menu(menu_root=None) %}
{%- for item in admin_view.admin.menu() %} {% if menu_root is none %}{% set menu_root = admin_view.admin.menu() %}{% endif %}
{%- for item in menu_root %}
{%- if item.is_category() -%} {%- if item.is_category() -%}
{% set children = item.get_children() %} {% set children = item.get_children() %}
{%- if children %} {%- if children %}
...@@ -57,8 +58,9 @@ ...@@ -57,8 +58,9 @@
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro menu_links() %} {% macro menu_links(links=None) %}
{% for item in admin_view.admin.menu_links() %} {% if links is none %}{% set links = admin_view.admin.menu_links() %}{% endif %}
{% for item in links %}
{% if item.is_accessible() and item.is_visible() %} {% if item.is_accessible() and item.is_visible() %}
<li> <li>
<a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a> <a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment