{% macro menu(menu_root=None) %} {% set is_main_nav = menu_root == None %} {% if menu_root is none %}{% set menu_root = admin_view.admin.menu() %}{% endif %} {% endmacro %} {% macro menu_links(links=None) %} {% if links is none %}{% set links = admin_view.admin.menu_links() %}{% endif %} {% for item in links %} {% set class_name = item.get_class_name() %} {% if item.is_accessible() and item.is_visible() %} {{ item.name }} {% endif %} {% endfor %} {% endmacro %} {% macro build_service_navigation_items(menu_root=None) -%} {% if menu_root is none %}{% set menu_root = admin_view.admin.menu() %}{% endif %} {% set nav_items = [] %} {% for item in menu_root %} {% if item.is_category() %} {# Handle category with children #} {% set children = item.get_children() %} {% if children %} {% for child in children %} {% if child.is_accessible() and child.is_visible() and not child.is_category() %} {% set item_text = item.name ~ " - " ~ child.name %} {% set _ = nav_items.append({ "href": child.get_url(), "text": item_text, "active": child.is_active(admin_view) }) %} {% endif %} {% endfor %} {% endif %} {% else %} {# Handle non-category items (skip "Home") #} {% if item.is_accessible() and item.is_visible() and item.name != "Home" %} {% set _ = nav_items.append({ "href": item.get_url(), "text": item.name, "active": item.is_active(admin_view) }) %} {% endif %} {% endif %} {% endfor %} {{- nav_items -}} {%- endmacro %} {% macro messages() %} {% with messages = get_flashed_messages(with_categories=True) %} {% if messages %} {% for category, m in messages %} {% if category %} {# alert-error changed to alert-danger in bootstrap 3, mapping is for backwards compatibility #} {% set mapping = {'message': 'info', 'error': 'danger'} %}
{% else %}
{% endif %} {{ m }}
{% endfor %} {% endif %} {% endwith %} {% endmacro %}