{% extends 'leprikon/list.html' %}
{% load i18n sekizai_tags static %}

{% block content %}
{{ block.super }}

{% include 'leprikon/static/bootstrap-multiselect.html' %}

{% addtoblock "js" %}
<script type="text/javascript">
$(document).ready(function() {
    $('#list_filter_form select[data-type=ModelMultipleChoiceField]').multiselect({
        enableFiltering: true,
        filterPlaceholder: '{% trans 'Search' %}',
        nonSelectedText: '',
        allSelectedText: false,
        numberDisplayed: 2,
        nSelectedText: '{% trans 'selected' %}',
        onDropdownHide: function(element, checked) {
            $('#list_filter_form').submit();
        },
        disableIfEmpty: true,
    });
    $('#list_filter_form select[data-type=MultipleChoiceField]').multiselect({
        nonSelectedText: '',
        allSelectedText: false,
        numberDisplayed: 2,
        nSelectedText: '{% trans 'selected' %}',
        onDropdownHide: function(element, checked) {
            $('#list_filter_form').submit();
        },
        disableIfEmpty: true,
    });
    $('#list_filter_form input[data-type=CharField]').change(function() {
        $('#list_filter_form').submit();
    });
    $('#list_filter_form input[data-type=BooleanField]').change(function() {
        $('#list_filter_form').submit();
    });
});
</script>
{% endaddtoblock %}

{% endblock %}
