{% load i18n future pages_tags %}
{% spaceless %}
{% if page_branch_in_menu %}

{% if branch_level == 0 %}
<ul class="nav pull-right">
    {% for page in page_branch %}
    {% if not has_home and page.is_primary and forloop.first %}
    <li class="{% if on_home %} active{% endif %}" id="dropdown-menu-home">
        <a href="{% url "home" %}">{% trans "Home" %}</a>
    </li>
    {% endif %}
    {% if page.in_menu %}
    <li class="dropdown{% if page.is_current_or_ascendant %} active{% endif %}"
        id="dropdown-menu-{{ page.html_id }}">
        <a href="{{ page.get_absolute_url }}">
            {{ page.title }}
            {% if page.has_children_in_menu %}<span class="caret"></span>{% endif %}
        </a>
        {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
    </li>
    {% endif %}
    {% endfor %}
    <li class="divider-vertical"></li>
</ul>
{% endif %}

{% if branch_level == 1 %}
<ul class="dropdown-menu">
    {% for page in page_branch %}
    {% if page.in_menu %}
    <li{% if page.is_current_or_ascendant %} class="active"{% endif %}
        id="dropdown-menu-{{ page.html_id }}">
        <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
    </li>
    {% endif %}
    {% endfor %}
</ul>
{% endif %}

{% endif %}
{% endspaceless %}
