{% extends "admin/change_list.html" %}
{% load admin_interface_tags admin_list i18n %}
{# copied from django 5.1.2 #}

{% block filters %}
    {% if cl.has_filters %}
    <nav id="changelist-filter" aria-labelledby="changelist-filter-header">
        <h2 id="changelist-filter-header">{% translate 'Filter' %}</h2>

        {% if cl.is_facets_optional or cl.has_active_filters %}
        <div id="changelist-filter-extra-actions">
            {% if cl.is_facets_optional %}
            <h3>
                {% if cl.add_facets %}
                {# Translators: don't translate this, the django catalog already contains it #}
                <a href="{{ cl.remove_facet_link }}" class="hidelink">{% translate "Hide counts" %}</a>
                {% else %}
                {# Translators: don't translate this, the django catalog already contains it #}
                <a href="{{ cl.add_facet_link }}" class="viewlink">{% translate "Show counts" %}</a>
                {% endif %}
            </h3>
            {% endif %}

            <!-- {# begin "list_filter_removal_links" #} -->
            {% get_admin_interface_active_date_hierarchy cl as active_date_hierarchy %}
            {% get_admin_interface_setting "list_filter_removal_links" as list_filter_removal_links %}
            {% if list_filter_removal_links %}
                {% if cl.has_active_filters or active_date_hierarchy %}
                    <div class="changelist-filter-clear-container">
                        <h3 id="changelist-filter-clear">
                            {# Translators: don't translate this, the django catalog already contains it #}
                            <a href="{{ cl.clear_all_filters_qs }}">&#10006; {% translate "Clear all filters" %}</a>
                        </h3>
                        {% if active_date_hierarchy %}
                            {% admin_interface_date_hierarchy_removal_link cl active_date_hierarchy %}
                        {% endif %}
                        {% if cl.has_active_filters %}
                            {% for spec in cl.filter_specs %}
                                {% admin_interface_filter_removal_link cl spec %}
                            {% endfor %}
                        {% endif %}
                    </div>
                {% endif %}
            {% else %}
                <!-- {# use default django template code #} -->
                {% if cl.has_active_filters %}
                <h3>
                    <a href="{{ cl.clear_all_filters_qs }}">&#10006; {% translate "Clear all filters" %}</a>
                </h3>
                {% endif %}
                <!-- {# end use default django template code #} -->
            {% endif %}
            <!-- {# end "list_filter_removal_links" #} -->

        </div>
        {% endif %}

        {% for spec in cl.filter_specs %}
            {% admin_list_filter cl spec %}
        {% endfor %}
    </nav>
    {% endif %}
{% endblock filters %}
