{#
NAV
It builds nav menu from the decorator @nav_menu
The menu can be accessed in the __.__NAV_MENU__.
__.__NAV_MENU__ is an sorted list of all the menu items
Structures:
[
(index, name, enpoint or sub_items, kwargs), ...
]
index: int - The position of the item
name: str - The name to place in the menu
|- endpoint: str
endpoint
#or
|- sub_items: list of
[
(index, name, endpoint, kwargs), ...
]
kwargs:
- active
- endpoint_kwargs
- has_submenu
- index
- visible:
#}
{# -------------------------------------------------------------------------- #}
{%- macro _format_key(val, def) -%}
{{- val | default(def, true) | slug -}}
{%- endmacro -%}
{#
Create a bootstrap navbar
:brand: The brand of the site, can include anything. It can be used to add
image, ie: brand=""
:url: The url when the brand is clicked on
:text: A text to use
:fluid: If true it will expand menu all across
:fixed: If true it will place the menu on top in a fixed position
:fixed_padding_top: When fixed, specify the top padding in px
:menu_id: if there are more that one menu, to make them unique
:groups: (list) - list of menu groups to accept
:exclude_groups: (list) - list of menu groups to exclude
:show_menus: (bool) - to hide/show menu. Usually for admin when user is not authenticated.
per menu show/hide, use [visible]
#}
{% macro top_nav(brand="",
url="/",
navbar_text="",
navbar_text_align_right=False,
fluid=True,
fixed=True,
fixed_padding_top="70px",
menu_id=1,
groups=[],
exclude_groups=[],
show_menus=True)
%}
{% if fixed %}
{% endif %}
{% endmacro %}
{% macro _navbar_sub_list(nav) %}
{% if nav[3]["visible"] %}
{% if nav[3]["has_submenu"] and nav[2] %}
{% set nav_title = nav[1] %}
{% set nav_items = nav[2] %}
{% set nav_kwargs = nav[3] %}
{% if nav_title %}