{# Sidebar, ported from shadcn/ui's sidebar-07 block. Three regions, as the block has them: the brand header, one group of menu items (a category becomes a Collapsible with a sub-menu), and a footer showing who is signed in. Plus the rail on the outer edge. `collapsed` (the desktop icon rail) and `sidebarOpen` (the mobile sheet) both come from base.html's provider, and are separate axes on purpose: a phone gets the overlay, never the rail. Collapsing hides labels rather than re-templating, so there is one copy of the nav. Each label sits in an `x-show="!collapsed"` span while the icon stays put -- nav-item's p-2 plus a size-4 icon is exactly the 3rem collapsed width, so nothing slides sideways as the width animates. md:sticky, not md:static, undoes the sheet's `fixed`: the rail is absolutely positioned against the aside, and a static aside handed it to the page, parking it on the viewport's right edge. Included, not a macro, so it shares base.html's ambient context. `icon` rides in on that context; csrf_field does not, since base.html has no form of its own, so the sign-out form imports it here. #} {% from "admin/components/csrf-field.html" import csrf_field %} {# The footer's identity block: avatar, name and role. Its own macro because the footer renders it in two shapes -- as the trigger of the user menu, and, with no session to sign out of, as a plain row with nothing to open. Principal names are never translated, except the framework's own default (AllowAllAuthenticator's "Anonymous"). #} {% macro sidebar_user(principal) %} {% set display_name = principal.display_name or principal.id %} {% if display_name == "Anonymous" %}{% set display_name = _(display_name) %}{% endif %} {{ display_name[:2] | upper }} {{ display_name }} {{ _("Superuser") if principal.is_superuser else _("Signed in") }} {% endmacro %}