{% load i18n gipsy_dashboard %}

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

        {% for item in items %}
            {% if item in items_parents %}
            <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 %}
                        {% if child in items_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>
                        {% endif %}
                    {% endfor %}
                    </ul>
                {% endif %}
            </li>
            {% endif %}
        {% endfor %}

        <li class="{% url_active 'admin:all_apps' %}">
            <a href="{% url vanilla_index_url %}">
                <i class="fa fa-list"></i>
                {% trans 'All applications list' %}
            </a>
        </li>
    </ul>
</aside>
{% endif %}
