{% extends "./base_iframe.html" %}

{% load i18n wagtailadmin_tags %}

{% block content %}
    <div class="wagtail-fedit-form-wrapper{% if form.block.block.meta.fedit_full %} fedit-full{% endif %}">
        {% block errors %}
            {% if form.errors or form.non_field_errors %}
                <div class="error-message">
                    <h2>{% translate "Validation errors" %}</h2>
                    <ul>
                        {% for error in form.non_field_errors %}
                            <li>{{ error }}</li>
                        {% endfor %}
                        {% for field, errors in form.errors.items %}
                            {% for error in errors %}
                                <li>{{ field }}: {{ error }}</li>
                            {% endfor %}
                        {% endfor %}
                    </ul>
                </div>
            {% endif %}
        {% endblock %}
        <form id="wagtail-fedit-form" action="{{ edit_url }}" method="post" {% for k, v in form_attrs.items %}{{ k }}="{{ v|safe }}" {% endfor %}>
            {% csrf_token %}
            {% block form %}
                {% panel id="wagtail-fedit-editor" icon="draft" heading=block.label %}
                    <div class="wagtail-fedit-form">
                        {% for field in form %}
                            {% include "./field.html" %}
                        {% endfor %}
                    </div>
                {% endpanel %}
            {% endblock %}
        </form>
    </div>
{% endblock %}