{% extends "admin/base_site.html" %}
{% load i18n admin_urls %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} revert-confirmation{% endblock %}

{% block breadcrumbs %}
    <div class="breadcrumbs">
        <a href="{% url 'admin:index' %}">{% trans "Home" %}</a> &rsaquo;
        <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> &rsaquo;
        <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst|escape }}</a> &rsaquo;
        <a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">{{ version.object_repr|truncatewords:"18" }}</a> &rsaquo;
        <a href="../">{% trans "History" %}</a> &rsaquo;
        {% blocktrans with opts.verbose_name as verbose_name %}Restore deleted {{ verbose_name }}{% endblocktrans %}
    </div>
{% endblock %}

{% block content %}
    <p>
        {% blocktrans with escaped_object=version.object_repr %}
            Are you sure you want to restore the {{ object_name }} "{{ escaped_object }}" to its version from {{ revision_date }}?
        {% endblocktrans %}
    </p>

    {% if placeholders_to_restore %}
        <p>{% trans 'The following placeholders were deleted and will be restored:' %}</p>
        <ul>
            {% for placeholder_version in placeholders_to_restore %}
                <li>{{ placeholder_version.content_type.name|capfirst }} #{{ placeholder_version.object_id_int }}: {{ placeholder_version.object_repr }}</li>
            {% endfor %}
        </ul>
    {% endif %}

    {% if conflicts %}
        <h3>{% trans 'Warning there are conflicts' %}</h3>
        <p>{% trans 'Please restore required related objects first:' %}</p>
        <ul>
            {% for conflict in conflict_links %}
                <li><a href="{{ conflict.link }}">{{ conflict.version.content_type.name|capfirst }} #{{ conflict.version.object_id_int }}: {{ conflict.version.object_repr }}</a></li>
            {% endfor %}
        </ul>
    {% endif %}

    {% if restore_form %}
        {% if non_resolvable_conflicts %}
            <h3>{% trans 'The following conflicts would be recovered automatically' %}</h3>
            <ul>
                {% for conflict in non_resolvable_conflicts %}
                    <li>{{ conflict.content_type.name|capfirst }} #{{ conflict.object_id_int }}: {{ conflict.object_repr }}</li>
                {% endfor %}
            </ul>
        {% endif %}

        <form action="" method="post">
            {% csrf_token %}
            {{ restore_form.as_p }}
            <div>
                <input type="hidden" name="post" value="yes" />
                <input type="submit" value="{% trans "Yes, I'm sure" %}" />
                <a href="#" onclick="window.history.back(); return false;" class="button cancel-link">{% trans "No, take me back" %}</a>
            </div>
        </form>
    {% endif %}

{% endblock %}
