{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% block titletag %}{% blocktrans with query=query.query_string %}Editing {{ query }}{% endblocktrans %}{% endblock %}
{% block content %}
    {% trans "Editing" as editing_str %}
    {% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=query.query_string icon="pick"  %}

    <form action="{% url 'wagtailsearch_editorspicks_edit' query.id %}" method="POST" class="nice-padding">
        {% csrf_token %}

        <ul class="fields">
            <li>
                {% include "wagtailsearch/queries/chooser_field.html" with field=query_form.query_string only %}   
            </li>
            <li> 
                {% include "wagtailsearch/editorspicks/includes/editorspicks_formset.html" with formset=editors_pick_formset only %}
            </li>
            <li>
                <input type="submit" value="{% trans 'Save' %}" />
                <a href="{% url 'wagtailsearch_editorspicks_delete' query.id %}" class="button button-secondary no">{% trans "Delete" %}</a>
            </li>
        </ul>
    </form>
{% endblock %}

{% block extra_css %}
    {% include "wagtailadmin/pages/_editor_css.html" %}
{% endblock %}
{% block extra_js %}
    {% include "wagtailadmin/pages/_editor_js.html" %}

    <script type="text/javascript">
        {% include "wagtailsearch/editorspicks/includes/editorspicks_formset.js" with formset=editors_pick_formset only  %}
        {% include "wagtailsearch/queries/chooser_field.js" only %}

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