{% load i18n %}

<style>
	body {
    padding-top: 35px;
  }
  nav {
    background-color: #fff !important;
  }
  nav .content {
    width: 970px;
    margin: 0 auto 0 auto;
  }
  nav form[role="search"] input {
    width: 179px;
  }
</style>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="content">
    
    <!-- App Name -->
    <div class="navbar-header">
      <a class="navbar-brand" href="{% url 'yplaces:index' %}">YPlaces</a>
    </div>
    
    <!-- Left Items -->
    <form class="navbar-form navbar-left" role="search" action="{% url 'yplaces:search' %}" method="GET">
      <div class="form-group">
        <input type="text" class="form-control" name="name" placeholder="{% trans 'Name' %}" value="{{ search_name }}">
      </div>
      <div class="form-group">
        <input type="text" class="form-control" name="location" placeholder="{% trans 'Location' %}" value="{{ search_location }}">
      </div>
      <button type="submit" class="btn btn-default">
        <i class="fa fa-search"></i>
        {% trans 'Search' %}
      </button>
      <a class="btn btn-primary" href="{% url 'yplaces:add' %}">
        <i class="fa fa-plus"></i>
        {% trans 'Add' %}
      </a>
    </form>

    <!-- Right Items -->
    <ul class="nav navbar-nav navbar-right">
      {% if request.user.is_authenticated %}
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            <i class="fa fa-user"></i>
            {{ request.user.name }} <b class="caret"></b>
          </a>
          <ul class="dropdown-menu" role="menu">
            {% if user.is_superuser %}
              <li>
                <a href="{% url 'admin:index' %}" target="_blank">
                  <i class="fa fa-wrench"></i>
                  Admin
                </a>
              </li>
              <li class="divider"></li>
            {% endif %}
            <li>
              <a href="{% url 'yaccounts:index' %}">
                <i class="fa fa-cog"></i>
                Settings
              </a>
            </li>
            <li>
              <a href="{% url 'yaccounts:logout' %}?next={{ request.path }}">
                <i class="fa fa-power-off"></i>
                Logout
              </a>
            </li>
          </ul>
        </li>
      {% else %}
        <li>
          <a href="{% url 'yaccounts:login' %}?next={{ request.path }}">Login</a>
        </li>
        <li>
          <a href="{% url 'yaccounts:create' %}"><strong>Sign Up</strong></a>
        </li>
      {% endif %}
    </ul>
    
  </div>
</nav>