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

{% if branch_level == 0 %}
<ul class="nav pull-right">
    {% for page in page_branch %}
    {% if page.is_primary and forloop.first %}
    <li class="{% if on_home %} active{% endif %}" id="dropdown-menu-{{ page.html_id }}">
        <a href="{% url home %}">{% trans "Home" %}</a>
    </li>
    <li class="divider-vertical"></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 %}<span class="caret"></span>{% endif %}
        </a>
        {% if page.has_children %}{% page_menu page %}{% endif %}
    </li>
    <li class="divider-vertical"></li>
    {% endif %}
    {% endfor %}
</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 %}
