{#{% load sitetree %}#}
{% load i18n suit_menu suit_tags %}
{% load url from future %}

{% with menu_position='menu_position'|suit_conf %}
    <ul class="nav nav-suit-menu nav-pills{% if menu_position == 'vertical' %} nav-stacked {% endif %}">
        {% block menu_home %}
            {% url 'admin:index' as index_url %}
            <li{% if index_url == request.path %} class="active"{% endif %}>
                <a href="{{ index_url }}"><i class="icon-home"></i>{% trans 'Home' %}
                </a>
            </li>
        {% endblock %}

        {% get_menu request as app_list %}
        {% if app_list %}
            {% for app in app_list %}
                {% if app.separator %}
                    <li class="separator"></li>
                {% else %}
                    <li{{ app.is_active|yesno:' class=active,' }}>
                        <a href="{{ app.url }}"{{ app.blank|yesno:' target=_blank,' }}><i class="{% firstof app.icon 'icon-chevron-right' %}"></i>{% trans app.label|capfirst %}
                        </a>
                        {% if app.models and not app.is_active %}
                            <ul class="nav nav-pills nav-stacked">
                                {% for model in app.models %}
                                    <li{{ model.is_active|yesno:' class=active,' }}>
                                        <a href="{{ model.url }}"{{ model.blank|yesno:' target=_blank,' }}>{{ model.label }}</a></li>
                                {% endfor %}
                            </ul>
                        {% endif %}
                    </li>
                {% endif %}
            {% endfor %}
        {% endif %}
    </ul>
    {% if app_list and menu_position == 'horizontal' %}
        {% get_sub_menu app_list as active_app_nodels %}
            <ul class="nav nav-suit-sub-menu nav-pills">
                {% if active_app_nodels %}
                    {% for model in active_app_nodels %}
                    <li{{ model.is_active|yesno:' class=active,' }}>
                        <a href="{{ model.url }}"{{ model.blank|yesno:' target=_blank,' }}>{{ model.label }}</a></li>
                {% endfor %}
                {% endif %}
            </ul>
    {% endif %}
{% endwith %}
