{% extends "admin/base.html" %}
{% load i18n admin_urls static admin_modify admin_list %}


{% block title %}{% if title %}{{ title }} | {% endif %}{{ site_title|default:_('Django site admin') }}{% endblock %}


{% block extrahead %}
  {{ block.super }}

  <link rel="stylesheet" href="{% static 'admin/bananas/css/bananas.css' %}">

  <style>
    :root {
      --theme-color: {{ settings.PRIMARY_COLOR|default:'#417690' }};
      --secondary-color: {{ settings.SECONDARY_COLOR|default:'#447e9b' }};
      --logo-align: {{ settings.LOGO_ALIGN|default:'middle' }};
    }
  </style>
{% endblock extrahead %}


{# Using blockbots block for backwards compability #}
{% block blockbots %}
  {{ block.super }}
  <link rel="stylesheet" href="{% static 'admin/css/responsive.css' %}">
  <link rel="stylesheet" href="{% static 'admin/bananas/css/banansive.css' %}">
{% endblock blockbots %}


{% block branding %}
  {# Include SVG icons as early as possible since some browsers have #}
  {# problems displaying SVG elements defined after their first use. #}
  <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
    <!-- (<) -->
    <symbol id="svg-chevron-left" viewBox="0 0 48 48">
      <circle cx="24" cy="24" r="23" fill="none" stroke-width="2" vector-effect="non-scaling-stroke" />
      <path d="M 28,10 L 14,24 28,38" fill="none" stroke-width="2" stroke-linecap="butt" vector-effect="non-scaling-stroke" />
    </symbol>
    <!-- = -->
    <symbol id="svg-hamburger" viewBox="0 0 48 48">
      <path d="M10 10 H38" fill="none" stroke-width="2" stroke-linecap="butt" vector-effect="non-scaling-stroke" />
      <path d="M10 24 H38" fill="none" stroke-width="2" stroke-linecap="butt" vector-effect="non-scaling-stroke" />
      <path d="M10 38 H38" fill="none" stroke-width="2" stroke-linecap="butt" vector-effect="non-scaling-stroke" />
    </symbol>
  </svg>

  <a href="{% url 'admin:index' %}"{% if settings.LOGO %} class="logo"{% endif %}>
    {% if settings.LOGO %}<img src="{% static settings.LOGO %}" style="{{ settings.LOGO_STYLE|default_if_none:'' }}">{% endif %}{{ site_header|default:_('Django administration') }}{% if settings.SITE_VERSION %}<span class="version">{{ settings.SITE_VERSION }}</span>{% endif %}
  </a>
{% endblock branding %}


{% block nav-global %}
  <div class="nav-global {% if cl.has_filters %} filtered{% endif %}">
    {# Only show searchbar, object-tools and filters on real changelists #}
    {% if cl.result_count != None %}
    {% block search %}{% endblock search %}
    {% endif %}
    <div id="object-tools">
      <h2>{% trans 'Tools' %}</h2>
      {% if view_tools %}
      <ul class="object-tools view-tools">
      {% for tool in view_tools %}
        <li>
          <a href="{{ tool.link }}" {{ tool.attrs }}>{{ tool.text }}</a>
        </li>
      {% endfor %}
      </ul>
      {% endif %}
      {% block object-tools %}{% endblock object-tools %}
    </div>
    {% block filters %}{% endblock filters %}
    {% if has_permission %}
      <nav>
        <ul>
          {% for app in available_apps %}
            <li>
              <a href="{{ app.app_url }}">
                {{ app.name }}
              </a>
              {% if app.models %}
                <ul>
                  {% for model in app.models %}
                    <li>
                      {% if model.admin_url %}
                        <a href="{{ model.admin_url }}">
                          {{ model.name }}
                        </a>
                      {% else %}
                        <a>{{ model.name }}</a>
                      {% endif %}
                    </li>
                  {% endfor %}
                </ul>
              {% endif %}
            </li>
          {% endfor %}

          <li>
            <a>
              {% block welcome-msg %}
                {% firstof user.get_short_name user.get_username %}
              {% endblock %}
            </a>

            <ul>
              {% if user.has_usable_password %}
                <li>
                  <a href="{% url 'admin:password_change' %}">
                    {% trans 'Change password' %}
                  </a>
                </li>
              {% endif %}

              <li>
                <a href="{% url 'admin:logout' %}">
                  {% trans 'Log out' %}
                </a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
    {% endif %}
  </div>
{% endblock nav-global %}


{% block messages %}
  <div id="messages">
    {{ block.super }}
  </div>
{% endblock messages %}


{% block content_title %}
  <div id="title" title="{{ opts.verbose_name_plural|capfirst }}">
    <button type="button" class="hamburger">
      <svg><use xlink:href="#svg-hamburger"/></svg>
    </button>

    {% if cl.opts %}
      <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}" class="back-arrow">
        <svg><use xlink:href="#svg-chevron-left"/></svg>
      </a>
      <span class="subject">{{ cl.opts.app_config.verbose_name }}</span>
    {% elif opts %}
      {% if has_change_permission or not object %}
          <a href="{% url opts|admin_urlname:'changelist' %}" class="back-arrow">
            <svg><use xlink:href="#svg-chevron-left"/></svg>
          </a>
      {% else %}
        <a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}" class="back-arrow">
          <svg><use xlink:href="#svg-chevron-left"/></svg>
        </a>
      {% endif %}
      <span class="subject">
        {{ opts.verbose_name_plural|capfirst }}
      </span>
    {% elif app_label %}
      <a href="{% url 'admin:index' %}" class="back-arrow">
        <svg><use xlink:href="#svg-chevron-left"/></svg>
      </a>
    {% else %}
      <span class="back-arrow"></span>
    {% endif %}

    {% if title %}
      <h1>{{ title }}</h1>
    {% endif %}
  </div>
  {% if view_tools %}
  <ul class="object-tools">
  {% for tool in view_tools %}
    <li>
      <a href="{{ tool.link }}" {{ tool.attrs }}>{{ tool.text }}</a>
    </li>
  {% endfor %}
  </ul>
  {% endif %}
{% endblock content_title %}


{% block footer %}
  {{ block.super }}
  <script>
    if (!window.django || !window.django.jQuery) {
      document.write('<script src="{% static 'admin/js/vendor/jquery/jquery.min.js' %}"><\/script>');
    }
  </script>
  <script>
    if (!window.django && window.jQuery) {
      window.django = {jQuery: window.jQuery.noConflict(true)};
    } else if (window.django && !window.django.jQuery) {
      window.django.jQuery = window.jQuery.noConflict(true);
    }
  </script>
  <script src="{% static 'admin/bananas/js/bananas.js' %}"></script>
{% endblock footer %}


{% block usertools %}{% endblock %}
{% block breadcrumbs %}{% endblock %}
