{% load i18n staticfiles %}

<nav class="navbar navbar-inverse navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed"
                            data-toggle="collapse"
                            data-target="#navbar"
                            aria-expanded="false"
                            aria-controls="navbar">
        <span class="sr-only">{% trans "Toggle navigation" %}</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="{% url namespace_|add:":main" %}">
        {{ namespace.title }}
      </a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <form class="navbar-form navbar-right"
            role="search"
            method="get"
            action="#">
            {# action="{% url namespace_|add:":search" %}"> #}
        <div class="form-group">
          <input type="text" 
                 class="form-control" 
                 name="q"
                 placeholder="{% trans "Search" %}">
        </div>
        <button type="submit" class="btn btn-default">
          {% trans "Go!" %}
        </button>
      </form>

      <ul class="nav navbar-nav navbar-right">
        {% with path=request.path %}
          {% if user.is_authenticated %}
            <li>
              <a href="{% url namespace_|add:":user_update" %}">
                {% blocktrans with name=user %}
                Profile ({{ name }})
                {% endblocktrans %}
              </a>
            </li>
            <li>
              <a href="{% url namespace_|add:":logout" %}?next={{ path }}">
                {% trans "Log out" %}
              </a>
            </li>
          {% else %}
            <li>
              <a href="{% url namespace_|add:":login" %}?next={{ path }}">
                {% trans "Log in" %}
              </a>
            </li>
            <li>
              <a href="{% url namespace_|add:":user_create" %}?next={{path }}">
                {% trans "Create an account" %}
              </a>
            </li>
          {% endif %}
        {% endwith %}
      </ul>
    </div>
  </div>
</nav>
