{# Admin chrome partial: two-row nav + conditional breadcrumbs + mobile drawer. Inputs (from `bragi.apps.admin._inject_admin_context`): - global_nav_groups: list[(section, list[NavItem])] (row 1) - site_nav_groups: list[(section, list[NavItem])] (row 2; suppressed if empty) - account_menu_items: list[NavItem] (user menu contents) - user_visible_sites: list[Site] (site switcher list) - current_site: Site | None - current_user_email / current_user_display_name - breadcrumbs: tuple[Crumb, ...] (row 3; suppressed if empty) The chrome ships zero JavaScript: dropdowns are
/; the mobile drawer is a hidden checkbox + sibling-combinator CSS. #} {% macro nav_link(item) -%} {{ item.label }} {%- endmacro %} {% macro render_groups(groups) -%} {%- for section_name, items in groups -%} {%- if not loop.first %}{% endif -%} {%- for item in items -%}{{ nav_link(item) }}{%- endfor -%} {%- endfor -%} {%- endmacro %} {# Sticky nav: rows 1 + 2 stick to the top together while the page scrolls. Breadcrumbs (below) and the mobile drawer stay in normal flow. `#nav-toggle` and `.admin-nav-drawer` remain siblings (the wrapper sits between them in document order) so the `#nav-toggle:checked ~ .admin-nav-drawer` selector still matches. #}
{# Row 1: global #} {# Row 2: site (suppressed if no site context or no items) #} {% if current_site and site_nav_groups %} {% endif %}
{# /.admin-nav-sticky #} {# Mobile drawer: same items as the two rows, stacked #}
{% if current_site %}
{{ current_site.title or current_site.hostname }} ▾ (switch site)
{% for site in user_visible_sites if not (site.id == current_site.id) %} {{ site.title or site.hostname }} {% endfor %}
{% endif %} {# Site nav only renders when in a site context; the url_for calls for site-scoped endpoints require site_slug in g, which the url_defaults hook only sets when the request URL carries it. #} {% if current_site and site_nav_groups %} {% for section_name, items in site_nav_groups %} {% if not loop.first %}
{% endif %} {% for item in items %}{{ nav_link(item) }}{% endfor %} {% endfor %}
{% endif %} {% for section_name, items in global_nav_groups %} {% if not loop.first %}
{% endif %} {% for item in items %}{{ nav_link(item) }}{% endfor %} {% endfor %}
{# Row 3: breadcrumbs (suppressed when chain is empty) #} {% if breadcrumbs %} {% endif %}