{% extends "admin/change_list.html" %}
{% load i18n admin_urls static admin_list semantic_utils %}

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

{% block extrahead %}
{{ block.super }}
{{ cl.model_admin.filterset.form.media.js }}
{% endblock %}

{% if not is_popup %}
{% block breadcrumbs %}
<div class="ui large breadcrumb" style="padding-left: 1rem;">
<a class="section" href="{% url 'admin:index' %}">{% trans "Home" %}</a>
<i class="right chevron icon divider"></i>
{# &rsaquo; <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{{ cl.opts.app_config.verbose_name }}</a> #}
<div class="section">{{ cl.opts.verbose_name_plural|capfirst }}</div>
</div>
{% endblock %}
{% endif %}

{% block object-tools %}
  {# <div class="object-tools"> #}
      {% block object-tools-items %}
        <div class="four wide field noprint"></div>
        <div class="four wide field noprint">
          {% if has_add_permission %}
            {% url cl.opts|admin_urlname:'add' as add_url %}
              <a class="ui green fluid button" href="{% add_preserved_filters add_url is_popup to_field %}" class="addlink">
              {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
            </a>
          {% endif %}
        </div>
      {% endblock %}
  {# </div> #}
{% endblock %}

{% block content %}
  <div id="content-main">
    {% 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="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
      {% block search %}{% search_form cl %}{% endblock %}
      {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}

      {% block filters %}
        {% if cl.has_filters %}
          <h2 style="margin-top: 0; padding-left: 1rem;" class="ui header">{% trans 'Filter' %}</h2>
          <div id="changelist-filter" class="ui secondary segment">
            <div class="ui form">
              {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
            </div>
          </div>
        {% endif %}
      {% endblock %}

      {% block before_changelist %}{% endblock %}

      <form id="changelist-form" 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 %}

        <div class="results">

        {% if cl.result_count %}
        <table id="result_list" class="ui large {% comment %}selectable{% endcomment %}{% if has_action_checkbox %} definition{% endif %} celled table">
          <thead class="full-width">
            {% if action_form and actions_on_top and cl.show_admin_actions %}
            <tr>
              <th colspan="100%">
                  {% admin_actions %}
              </th>
            </tr>
          {% endif %}
          {% semantic_result_list cl %}
        </table>

          {% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
      {% endif %}
        </div>
      {% endblock %}

      {% block pagination %}{% endblock %}
      </form>
    </div>
  </div>
{% endblock %}

{% block extrascript %}{% endblock %}
