{% extends "adminfilters/_wrapper.html" %}{% load i18n %}
{% block content %}
    <ul class="adminfilter"
        data-action="{% if spec.value.0 %}clear{% else %}filter{% endif %}"
        data-lk="{{ spec.lookup_kwarg }}"
        data-lk-negated="{{ spec.lookup_kwarg_negated }}"
        data-qs="{{ spec.query_string }}">
        {% if spec.can_negate %}
            <li><label><input type="checkbox"
                       class="filter-lookup negate {{ spec.lookup_kwarg }}"
                       data-group="{{ spec.lookup_kwarg }}"
                       data-original="{{ spec.value.1|lower }}"
                    {% if spec.value.1 %} checked="checked" {% endif %}>
                <small>{% trans "Exclude" %}</small></label></li>
        {% endif %}
        <li><input type="text" class="filter-lookup {{ spec.id }}"
                   placeholder="{{ spec.placeholder }}"
                   name="value"
                   autocomplete="{{ spec.html_attrs.id }}"
                   data-original="{{ spec.value.0 }}"
                   data-group="{{ spec.id }}"
                   value="{{ spec.value.0 }}"
                   style="width: 90%">
        </li>
        <li>
            <a class="filter-lookup adminfilters button {{ spec.id }} {% if spec.value.0 %}clear{% else %}filter{% endif %}"
               href="#">{% if spec.value.0 %}clear{% else %}activate{% endif %}</a>
        </li>
    </ul>
{% endblock %}
{% block script %}

    <script type="text/javascript">
        ;(function ($) {
            {# $(document).ready(function () {#}
                new ValueFilterHandler("#{{ spec.html_attrs.id }}", {{ spec.js_options|safe }});
            {# });#}
        })(django.jQuery);
    </script>
{% endblock %}
