{% load i18n wagtailadmin_tags %}
<h2>{% trans "Page permissions" %}</h2>

{{ formset.management_form }}{# what is this? #}

<table class="listing">
    <col width="40%"/>
    <col width="40%" />
    <col />
    <thead>
        <tr>
            <th>{% trans "Page" %}</th>
            <th>{% trans "Permission type" %}</th>
            <th></th>
        </tr>
    </thead>
    <tbody id="id_{{ formset.prefix }}-FORMS">
        {% for form in formset.forms %}
            <tr id="inline_child_{{ form.prefix }}"{% if form.DELETE.value %} style="display: none;"{% endif %}>
                {% if form.non_field_errors %}
                    <p class="error-message">
                        {% for error in form.non_field_errors %}
                            <span>{{ error|escape }}</span>
                        {% endfor %}
                    </p>
                {% endif %}
                {% include "wagtailusers/groups/includes/page_permissions_form.html" with form=form only %}
            </tr>
        {% endfor %}
    <tbody>
</table>

<script type="text/django-form-template" id="id_{{ formset.prefix }}-EMPTY_FORM_TEMPLATE">
{% escapescript %}
    <tr>
        {% include "wagtailusers/groups/includes/page_permissions_form.html" with form=formset.empty_form only %}
    </tr>
{% endescapescript %}
</script>

<p class="add">
    <a class="button bicolor icon icon-plus" id="id_{{ formset.prefix }}-ADD" value="Add">{% trans "Add a page permission" %}</a>
</p>

