<div class="navbar-fixed">
  <nav>
    <div class="nav-wrapper {{ crudlfap_site.navbar_color }}">
      <span href="#" data-action="click->sidenav#click" data-controller="sidenav" data-target="slide-out" class="sidenav-trigger"><i class="waves-effect material-icons">menu</i></span>
      <a class="brand-logo" href="{{ crudlfap_site.views['home'].url }}" class="waves-effect brand-logo">{{ crudlfap_site.title }}</a>
      <ul class="right">
        {% include 'crudlfap/_menu_auth.html' %}
      </ul>
    </div>
  </nav>
</div>

<ul id="slide-out" class="sidenav">

  <li class="no-padding {% if request.path == '/' %}active{% endif %}"><a href="/">Home</a></li>
  <li class="no-padding">
    <ul class="collapsible collapsible-accordion">
      {% for app, routers in crudlfap_site.get_app_menus('main', request).items() %}
        {% for router in routers %}
          <li class="{% if router == view.router %}active{% endif %}">
            <a class="collapsible-header waves-effect waves-teal">{% if router.material_icon %}<i class="material-icons">{{ router.material_icon }}</i>{% endif %} {{ router.model._meta.verbose_name_plural.capitalize() }}</a>
            <div class="collapsible-body">
              <ul>
                {% for v in router.get_menu('model', request) %}
                  <li>
                    <a
                      class="waves-effect"
                      href="{{ v.url }}"
                      title="{% if v.title %}{{ v.title }}{% endif %}"
                    >{% if v.material_icon %}<i class="material-icons">{{ v.material_icon }}</i>{% endif %}{{ _(v.urlname).capitalize() }}</a>
                  </li>
                {% endfor %}
              </ul>
            </div>
          </li>
        {% endfor %}
      {% endfor %}
    </ul>
  </li>

  {% if request.user.is_superuser %}
  <li>
    <a class="waves-effect" href="{{ url('crudlfap:urls') }}">URLs</a>
  </li>
  {% endif %}

  {% with liclass="no-padding" %}
  {% include 'crudlfap/_menu_auth.html' %}
  {% endwith %}
</ul>
