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

    {% if form.non_field_errors %}
        <div class="messages">
            <ul>
                {% for error in form.non_field_errors %}
                    <li class="error">{{ error }}</li>
                {% endfor %}
            </ul>
        </div>
    {% endif %}

    <form action="{% url 'wagtailredirects:edit' redirect.id %}" method="POST" class="nice-padding" novalidate>
        {% csrf_token %}

        <ul class="fields">
            {% for field in form.visible_fields %}
                {% include "wagtailadmin/shared/field_as_li.html" %}
            {% endfor %}

            <li>
                <input type="submit" value="{% trans 'Save' %}" class="button" />
                {% if user_can_delete %}
                    <a href="{% url 'wagtailredirects:delete' redirect.id %}" class="button button-secondary no">{% trans "Delete redirect" %}</a>
                {% endif %}
            </li>
        </ul>
    </form>

{% endblock %}

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