{% comment %}
    Includes the cradmin menu. You can make your view not render the menu by
    setting the ``cradmin_hide_menu`` context variable to ``True``.
{% endcomment %}
{% load i18n %}

{% if not cradmin_hide_menu %}
    <nav id="django_cradmin_mainmenu"
            django-cradmin-menu
            django-cradmin-menu-autodetect-overflow-y="django-cradmin-menu-overflow-y"
            class="django-cradmin-menu">
        {% block pre-menu %}{% endblock pre-menu %}

        <div class="django-cradmin-menu-mobileheader">
            {% block mobile-header %}
                {% block mobile-header-pre %}{% endblock mobile-header-pre %}
                    <a href="#" role="button"
                            class="django-cradmin-menu-mobiletoggle"
                            ng-click="cradminMenuTogglePressed()"
                            ng-class="{'django-cradmin-menu-mobile-toggle-button-expanded': cradminMenuDisplay}"
                            aria-pressed="{% verbatim %}{{ getAriaPressed() }}{% endverbatim %}">
                        {% block mobile-header-menutoggle-content %}
                            {% trans "Menu" %}
                        {% endblock mobile-header-menutoggle-content %}
                    </a>
                {% block mobile-header-post %}{% endblock mobile-header-post %}
            {% endblock mobile-header %}
        </div>

      <div class="django-cradmin-menu-content"
                ng-class="{'django-cradmin-menu-content-display': cradminMenuDisplay}">
            {% block menucontent %}
                {% with menu=request.cradmin_instance.get_menu %}
                    {% if menu.headeritems %}
                        <ul class="django-cradmin-menu-content-header">
                            {% for menuitem in menu.headeritems %}
                                {{ menuitem.render|safe }}
                            {% endfor %}
                        </ul>
                    {% endif %}
                    {% if menu.mainitems %}
                        <ul class="django-cradmin-menu-content-main">
                            {% for menuitem in menu.mainitems %}
                                {{ menuitem.render|safe }}
                            {% endfor %}
                        </ul>
                    {% endif %}
                    {% if menu.footeritems %}
                        <ul class="django-cradmin-menu-content-footer">
                            {% for menuitem in menu.footeritems %}
                                {{ menuitem.render|safe }}
                            {% endfor %}
                        </ul>
                    {% endif %}
                {% endwith %}
            {% endblock menucontent %}
        </div>

        {% block post-menu %}{% endblock post-menu %}
    </nav>

{% endif %}
