{% load i18n %}

{% if user.is_active and user.is_staff %}
<aside class="col-md-2 dashboard-sidebar">
    <ul class="nav nav-pills nav-stacked">
        <li{% if request.path == '/admin/' %} class="active"{% endif %}>
            <a href="{% url dashboard_url %}">
                <i class="fa fa-tachometer"></i>
                {% trans 'Dashboard' %}
            </a>
        </li>

        {% for item in items %}
        <li class="dropdown{% if item.pk == active.parent.pk %} open active{% endif %}">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                {% if item.icon %}<i class="fa {{ item.icon }}"></i>{% endif %}
                {{ item.name }}
                {% if item.children %}<i class="fa fa-chevron-down pull-right"></i>{% endif %}
            </a>
            
            {% if item.children %}
                <ul class="dropdown-menu" role="menu">
                {% for child in item.children %}
                    <li{% if active.pk == child.pk %} class="active"{% endif %}>
                        {% if child.url %}<a href="{% if not child.url_has_domain %}//{{ request.get_host }}/{% endif %}{{ child.url }}">{% endif %}
                            {{ child.name }}
                        {% if child.url %}</a>{% endif %}
                    </li>
                {% endfor %}
                </ul>
            {% endif %}
        </li>
        {% endfor %}

        <li{% if request.path == '/admin/all-apps' %} class="active"{% endif %}>
            <a href="{% url vanilla_index_url %}">
                <i class="fa fa-list"></i>
                {% trans 'All applications list' %}
            </a>
        </li>
    </ul>
</aside>
{% endif %}
