{% extends "admin/base_site.html" %}
{% load i18n admin_urls admin_static admin_list jet_tags %}

{% block content_title %}{% endblock %}

{% block extrastyle %}
    {{ block.super }}
    {% if cl.formset or action_form %}
    <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
    {% endif %}
    {{ media.css }}
{% endblock %}

{% block extrahead %}
    {{ block.super }}
    {{ media.js }}
    {% if action_form %}{% if actions_on_top or actions_on_bottom %}
        <script type="text/javascript">
        (function($) {
            $(document).ready(function($) {
                $("tr input.action-select").actions();
            });
        })(django.jQuery);
        </script>
    {% endif %}{% endif %}
{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}

{% if not is_popup %}
    {% block breadcrumbs %}
        <div class="breadcrumbs">
            <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
            &rsaquo; <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{% if cl.opts.app_config.verbose_name %}{{ cl.opts.app_config.verbose_name }}{% else %}{% trans app_label as app_label %}{{ app_label|capfirst|escape }}{% endif %}</a>
            &rsaquo; {{ cl.opts.verbose_name_plural|capfirst }}
        </div>
    {% endblock %}
{% endif %}

{% block coltype %}flex{% endblock %}

{% block content %}
  <div id="content-main">
    {% block object-tools %}
      {% if has_add_permission %}
        <ul class="object-tools fr">
          {% block object-tools-items %}
            <li>
              {% url cl.opts|admin_urlname:'add' as add_url %}
              <a href="{% jet_add_preserved_filters add_url is_popup to_field %}" class="addlink">
                {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
              </a>
            </li>
          {% endblock %}
        </ul>
      {% endif %}
    {% endblock %}

    {% if cl.formset.errors %}
        <p class="errornote">
        {% if cl.formset.total_error_count == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
        </p>
        {{ cl.formset.non_form_errors }}
    {% endif %}

    <div class="{% if cl.has_filters %} filtered{% endif %}" id="changelist">
        <div class="cf">
        <div id="changelist-filter" class="changelist-filter background-form">
            {% block search %}{% search_form cl %}{% endblock %}
            {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
        </div>

        </div>

        <form id="changelist-form" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
            {% if cl.formset %}
                <div>{{ cl.formset.management_form }}</div>
            {% endif %}

            {% block result_list %}
                {% result_list cl %}

                {% if cl.full_result_count %}
                    <div class="changelist-footer background-form{% if is_popup %} popup{% endif %}">
                        {% if action_form and cl.show_admin_actions != False and actions_on_top or actions_on_bottom %}{% admin_actions %}{% endif %}

                        <div class="fr">
                          {% block pagination %}{% pagination cl %}{% endblock %}
                        </div>
                    </div>
                {% endif %}
            {% endblock %}
        </form>
    </div>
  </div>
{% endblock %}
