{% extends "wagtailadmin/generic/edit.html" %}
{% load i18n wagtailadmin_tags %}
{% block form_content %}
    <ul class="fields">
        <li>
            {% include "wagtailsearchpromotions/queries/chooser_field.html" with field=form.query_string only %}
        </li>
        <li>
            {% include "wagtailsearchpromotions/includes/searchpromotions_formset.html" with formset=searchpicks_formset only %}
        </li>
    </ul>
{% endblock %}

{% block extra_js %}
    {{ block.super }}
    <script src="{% versioned_static 'wagtailsearchpromotions/js/query-chooser-modal.js' %}"></script>

    <script type="text/javascript">
        {% include "wagtailsearchpromotions/includes/searchpromotions_formset.js" with formset=searchpicks_formset only  %}
        {% include "wagtailsearchpromotions/queries/chooser_field.js" only %}

        $(function() {
            createQueryChooser('{{ form.query_string.auto_id }}');
        });
    </script>
{% endblock %}
