{% extends "nexus/admin/base_site.html" %}
{% load adminmedia admin_list i18n %}

{% block head %}
  {{ block.super }}
  {% if cl.formset %}
    <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
  {% endif %}
  {% if cl.formset or action_form %}
    {% url admin:jsi18n as jsi18nurl %}
    <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
  {% endif %}
  {{ media.css }}
    {{ 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 %}

{% if not is_popup %}
    {% block breadcrumb_bits %}
        <li><a href="../../">{% trans "Model Admin" %}</a></li>
        <li><a href="../">{{ app_label|capfirst }}</a></li>
        <li><span>{{ cl.opts.verbose_name_plural|capfirst }}</span></li>
    {% endblock %}
{% endif %}

{% block content %}
    {% block object-tools %}
        {% if has_add_permission %}
            <ul class="object-tools">
                <li>
                    <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="button small">
                        {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
                    </a>
                </li>
            </ul>
        {% endif %}
    {% endblock %}
    {% if cl.formset.errors %}
        <p class="errornote">
            {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
        </p>
        {{ cl.formset.non_form_errors }}
    {% endif %}
    <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
        <div class="clearfix">
            {% block search %}{% search_form cl %}{% endblock %}
            {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}

            {% block filters %}
                {% if cl.has_filters %}
                    <div id="changelist-filter">
                        <h2>{% trans 'Filter' %}</h2>
                        {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
                    </div>
                {% endif %}
            {% endblock %}
        
            <form id="changelist-form" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
            {% if cl.formset %}
                {{ cl.formset.management_form }}
            {% endif %}

            {% block result_list %}
                    <div id="toolbar-placeholder">
                        {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %}
                    </div>
                    {% result_list cl %}
                    {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}
            {% endblock %}
            </form>
        </div>
        {% block pagination %}{% pagination cl %}{% endblock %}
    </div>
{% endblock %}
