{% load i18n %}
<div class="navbar navbar-fixed-top">
    <div class="container-fluid">
        <div class="row-fluid">
            <ul class="nav span2">
                <li class="brand">
                    <a href="/">
                        <span class="logo"></span>
                        <span class="logo_title">Tribus</span>
                        <span class="logo_subtitle badge badge-yellow">alpha</span>
                    </a>
                </li>
                <li class="divider-vertical"></li>
            </ul>
            {% if user.is_authenticated %}
            <ul class="nav span4">
                 <li class="dropdown search" data-ng-controller="SearchListController">
                    <form name="form-search" class="form-search" action="/search" method="POST">
                        {% csrf_token %}
                        <span class="input-icon">
                            <input id="drop-search" type="text" class="nav-search-input input-large top_search_input" autocomplete="off" name="q" placeholder="{% trans 'What are you looking for?' %}" data-ng-model="top_search" data-ng-keyup="refreshResults()" />
                            <ul class="dropdown-menu" role="menu" aria-labelledby="drop-search">
                                <li role="presentation" class="dropdown-subtitles" data-ng-if="hasPackages()">
                                    {% trans "Packages" %}
                                </li>
                                <li role="presentation" data-ng-repeat="result in package_results">
                                    <a role="menuitem" tabindex="-1" href="{% verbatim %}{{ result.url }}{% endverbatim %}">
                                        {% verbatim %}{{ result.name }}{% endverbatim %}
                                    </a>
                                </li>
                                <li role="presentation" class="dropdown-subtitles" data-ng-if="hasUsers()">
                                    {% trans "Users" %}
                                </li>
                                <li role="presentation" data-ng-repeat="result in users_results">
                                    <a role="menuitem" tabindex="-1" href="{% verbatim %}{{ result.url }}{% endverbatim %}">
                                        {% verbatim %}{{ result.fullname }}{% endverbatim %}
                                    </a>
                                </li>
                                <li role="presentation" class="dropdown-subtitles" data-ng-if="noResults()">
                                    {% trans "There are no results matching this query." %}
                                </li>
                            </ul>
                            <span class="icon-search nav-search-icon"></span>
                        </span>
                    </form>     
                </li>                       
            </ul>
            <ul class="nav nav-spacer">
                <li class="width-100"></li>
            </ul>
            <ul class="nav span2 pull-right">
                <li class="home"></li>
                <li class="home">
                    <a href="/"><span class="bigger-150 icon-home"></span></a>
                </li>
                <li class="divider-vertical"></li>
                <li class="profile">
                    <a href="/profile/"><span class="bigger-150 icon-user"></span></a>
                </li>
                <li class="divider-vertical"></li>
                <li class="dropdown settings">
                    <a id="drop-settings" href="#" class="dropdown-toggle" role="button">
                        <span class="bigger-150 icon-cog"></span>
                    </a>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="drop-settings">
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="/password/change">{% trans "Change password" %}</a>
                        </li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="/logout">{% trans "Logout" %}</a>
                        </li>
                    </ul>
                </li>
            </ul>
            {% else %}
            <ul class="nav span8">
                <li class="width-100"></li>
            </ul>
            <ul class="nav span2">
                <li class="width-100">
                    <a class="btn btn-yellow btn-block" href="{% url 'registration_login' %}">
                        {% trans "Log in" %}
                    </a>
                </li>
            </ul>
            {% endif %}
        </div>
    </div>
</div>
<script type="text/javascript">
    var packages_url_placer = '/cloud/p/%PACKAGE%';
    var user_url_placer = '/profile/%USER%';
</script>
