{% load i18n brickwork_icons %} {% comment %} Recursive nav render (NAV-016: one render shared by desktop sidebar + mobile drawer). Uses Django 6.0 {% partialdef %} for the recursive item partial; brickwork is the first umbrella package to use the 6.0 template partials, so there is no django-cotton / django-render-block here (BR-BW-TPL-003/004). Items arrive already prepared by {% bw_nav %} (URL resolved via safe_reverse, active/ancestor-active state and the disabled/external flags computed), so this template is pure presentation: no {% url %} that could 500 (BR-BW-NAV-003), no permission logic (visibility was filtered upstream). Optional context from the tag: orientation ("vertical"|"horizontal", default "vertical"). Horizontal adds bw-nav__list--horizontal on the root list (NAV-024 / #430) so a topbar-shaped band does not require styling package-private BEM from the consumer. labels ("truncate"|"wrap", default "truncate"). Wrap adds bw-nav__list--labels-wrap so long labels break rather than ellipsis (#671); docs rails should pass labels="wrap", app sidebars keep the default. {% endcomment %} {% partialdef nav_item %} {% comment %} `item` is a RenderedNavItem. {% endcomment %} {% if item.is_section_header %}
  • {{ item.label }} {% if item.children %} {% endif %}
  • {% else %}
  • {% if item.is_disabled %} {% if item.icon %}{% bw_icon item.icon decorative=True css_class="bw-nav__icon" %}{% endif %} {{ item.label }} {% if item.badge is not None %}{{ item.badge }}{% endif %} {% else %} {% if item.icon %}{% bw_icon item.icon decorative=True css_class="bw-nav__icon" %}{% endif %} {{ item.label }} {% if item.badge is not None %}{{ item.badge }}{% endif %} {% if item.is_external %}{% bw_icon "external-link" size="sm" decorative=True css_class="bw-nav__external" %}{% endif %} {% endif %} {% if item.children %} {% endif %}
  • {% endif %} {% endpartialdef %}