{% extends "newman/change_list.html" %}
{% load admin_list newman_list cache %}

{% block content %}
    <div class="js-hashadr-container" id="changelist">

        <form class="js-form js-dyn-adr" action="." method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>
            {% csrf_token %}
            {% if cl.formset %}
                {{ cl.formset.management_form }}
            {% endif %}

            <label for="id_category_suggest" style="float: left;">{% trans 'Category' %}: </label>
            <div style="width: 300px; float: left;">
                <input id="id_category" class="vForeignKeyRawIdAdminField hidden" type="text" name="category" style="display: none;"/>
                <ul class="GenericSuggestField">
                <li>
                <input id="id_category_suggest" type="text" rel="/core/category/suggest/?f=__unicode__&f=title&f=slug&f=tree_path&q=" autocomplete="off"/>
                </li>
                </ul>
                <a id="lookup_id_category" class="suggest-related-lookup" href="/core/category/?pop"></a>
            </div>
            <a class="icn btn ok def js-category-redir js-nohashadr">{% trans 'Go' %}</a>
            <div class="cb"></div>
            {% ifnotequal cl.paginator.num_pages 1 %}{% pagination cl %}{% endifnotequal %}
            {% block result_list %}
                {# % if actions_on_top and cl.full_result_count and not is_popup %}{% admin_actions %}{% endif % #}
                {% newman_result_list cl %}
                {% if actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}
            {% endblock %}
            {% block pagination %}{% pagination cl %}{% endblock %}
            <div class="js-form-metadata">
                <input type="hidden" name="success" id="changelist-batch-success" />
                <script type="text/javascript">
                    $('#changelist-batch-success').data('callback', changelist_batch_success);
                </script>
            </div>
        </form>

    </div>
{% endblock %}

{% block content_js %}
    {{ block.super }}

    <script type="text/javascript">
        request_media('{{ NEWMAN_MEDIA_URL }}js/positions.js');
        request_media('{{ NEWMAN_MEDIA_URL }}js/generic.suggest.js');
        request_media('{{ NEWMAN_MEDIA_URL }}css/generic.suggest.css');
    </script>

    {% if media %}
        {% cache 300 'nm-cl-js' cl %}
        <script type="text/javascript">
        {% for m in media %}
            request_media('{{ m }}');
        {% endfor %}
        </script>
        {% endcache %}
    {% endif %}
{% endblock %}
