{# MENU It builds menu from the decorator @menu The menu can be accessed in the __.MENU. __.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: #} {# -------------------------------------------------------------------------- #} {# To a create navbar :brand: The brand of the site, can include anything :url: The url when the brand is clicked on :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 navbar(brand="", url="/", 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_name = nav[1] %} {% set nav_items = nav[2] %} {% set nav_kwargs = nav[3] %} {% set show_user_avatar = nav_kwargs["show_profile_avatar"] and current_user and current_user.is_authenticated %} {% if nav_name %}