{% spaceless %}
{% load avatar_tags %}
{% load flatpages %}
{% load i18n %}
{% load leaflet_tags %}
{% load static %}
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Sans" />
<link rel="stylesheet" href="{% static 'map/bootstrap/css/bootstrap.min.css' %}" />
<link rel="stylesheet" href="{% static 'map/bootstrap/css/bootstrap-theme.min.css' %}" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"/>

<title>{% block page_title %}Ojuso{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

{# Additional Stylesheets #}
{% block stylesheets %}
<style>
.navbar-brand { padding: 5px 15px; }
.navbar-brand > img { height: 40px; }
.dropdown-menu > li > a.no-hover:hover, .dropdown-menu > li > a.no-hover:focus {
  background: red;
}

.footer {
  background-color: #444;
  color: #ddd;
  padding-top: 1em;
  margin-top: 5em;
}

.linklist {
  list-style-type: none;
  text-align: right;
  margin-left: 0;
  padding-left: 0;
}

.linklist a {
  color: #ddd;
  text-decoration: underline;
}

.linklist a:hover {
  color: #bbb;
}

.linklist-item--spacer {
  margin-top: 1em;
}

}
</style>
{% endblock %}
</head>
<body>
  <nav class="navbar navbar-default">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
          <span class="sr-only">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 'index' %}">
          <img src="{% static 'map/images/ojuso-logo-black.png' %}" height="15px"/>
        </a>
      </div>
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav">
          <li><a href="{% url 'index' %}">{% trans 'Map' %}</a></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About <span class="caret"></span></a>
            <ul class="dropdown-menu">
              {% get_flatpages '/about/' as about_pages %}
              {% for page in about_pages %}
              <li><a class="nav-link" href="{{page.url}}">{{page.title}}</a></li>
              {% endfor %}
            </ul>
          </li>

        </ul>
        <ul class="nav navbar-nav navbar-right">
          <li class="form-group">
            <form class="navbar-form navbar-left">
              {# Global language selection dropdown #}
              {% get_available_languages as LANGUAGES %}
              {% get_current_language as LANGUAGE_CODE %}
              <select id="id-language-dropdown" name="language-dropdown">
                  {% for language in LANGUAGES %}
                      {% if language.0 == LANGUAGE_CODE %}
                          <option value="{{ language.0 }}" selected="selected">{{ language.0|language_name_local|title }}</option>
                      {% else %}
                          <option value="{{ language.0 }}">{{ language.0|language_name_local|title }}</option>
                      {% endif %}
                  {% endfor %}
              </select>
            </form>
          </li>
          {% if user.is_authenticated %}
          <a class="btn btn-primary navbar-btn" href="{% url 'create' %}"><i class="fa fa-plus" aria-hidden="true"></i> New Case Study</a>
          <li class="dropdown">
            <a style="margin:-10px 0 -10px 0" class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              <img src="{% avatar_url user %}" class="img-circle" width="40" height="40" style="position:relative;margin-right:5px"/><span>{{user}}</span>
            </a>
            <ul class="dropdown-menu dropdown-menu-right" style="padding-bottom:0px" aria-labelledby="navbarDropdown">
              <li><a href="{% url 'avatar_change' %}"><i class="fa fa-cog" aria-hidden="true"></i> Change Avatar</a></li>
              <li><a href="{% url 'profile:detail' %}"><i class="fa fa-cog" aria-hidden="true"></i> Profile</a></li>
              <li role="separator" style="margin-bottom:0px"></li>
              <li><a class="dropdown-item no-hover" style="background-color:red;color:white;padding:0.5rem 1.5rem" href="{% url 'auth_logout' %}"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> {% trans 'Logout' %}</a></li>
            </ul>
          </li>

          {% else %}
          <a style="margin: 5px;" class="btn btn-primary navbar-btn" href="{% url 'auth_login' %}">{% trans 'Login' %}</a></li>
          <a style="margin: 5px;" class="btn btn-info navbar-btn" href="{% url 'registration_register' %}">{% trans 'Register' %}</a></li>
          {% endif %}
        </ul>
      </div>
    </div>
  </nav>

  {% if messages %}
    {% for message in messages %}
    <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert">
        {{ message }}
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    {% endfor %}
  {% endif %}

  {% block content %}
  {% endblock %}

  {% block footer %}
  <footer class="footer">
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
          <ul class="linklist">
            <li><a href="{% url 'index' %}">Map of all case studies</a>
            {% get_flatpages '/about/' as all_pages %}
            {% for page in all_pages %}
              <li><a href="{{ page.url }}">{{ page.title }}</a></li>
            {% endfor %}
            <li class="linklist-item--spacer">&copy; Ojuso 2018
          </ul>
        </div>
      </div>
    </div>
  </footer>
  {% endblock %}

  {# CDN Javascript #}
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0=" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  <script src="{% static "map/language.js" %}"></script>
  {% block scripts %}{% endblock %}

</html>
{% endspaceless %}