{% extends "admin/delete_confirmation.html" %}
{% load i18n static admin_urls cms_tags djangocms_alias_tags %}

{% block extrahead %}
    {{ block.super }}
    {{ media }}
    <script src="{% static 'admin/js/cancel.js' %}" async></script>
{% endblock %}

{% block breadcrumbs %}{% endblock %}

{% block content %}
<p>
  {% if perms_needed or protected %}
    {% blocktrans with escaped_object=object %}You don't have permissions to delete {{ object_name }} "{{ escaped_object }}". Please request your site admin to add permissions to delete alias, or delete alias from all places that it being used.{% endblocktrans %}
  {% else %}
    {% blocktrans with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"?{% endblocktrans %}
  {% endif %}
</p>

<br/>

{% if object.objects_using %}
  {% blocktrans with escaped_object=object %}This alias is used by following objects:{% endblocktrans %}
  <ul>
      {% for item in object.objects_using %}
      <li>
          {{ item|verbose_name|capfirst|escape }}:
          <a href="{{ item.get_absolute_url }}">{{ item }}</a>
      </li>
      {% endfor %}
  </ul>
{% else %}
  {% blocktrans with escaped_object=object %}This alias wasn't used by any object.{% endblocktrans %}
{% endif %}

<form method="post">{% csrf_token %}
  <div>
    <input type="hidden" name="post" value="yes" />
    {% if not perms_needed and not protected %}
      <input type="submit" value="{% trans "Yes, I'm sure" %}" />
    {% endif %}
    <a href="#" class="button cancel-link">{% trans "No, take me back" %}</a>
  </div>
</form>
{% endblock %}
