{% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %}

{% block pagetitle %}{% trans "Delete" %} "{{ attachment.current_revision.get_filename }}"{% endblock %}

{% block wiki_contents_tab %}

{% if attachment.article == article %}
<h2>{% trans "Delete" %} "{{ attachment.current_revision.get_filename }}"?</h2>
  <p class="lead">
    {% blocktrans with attachment.original_filename as filename trimmed %}
    The file may be referenced on other articles. Deleting it means that they will loose their references to this file. The following articles reference this file:
    {% endblocktrans %}
  </p>
  <ul>
    {% for a in attachment.articles.all %}
      <li style="font-size: 150%;">{{ a.current_revision.title }}</li>
    {% endfor %}
  </ul>
<hr />
<form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data">
  {% wiki_form form %}
  <div class="form-actions">
    <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}" class="btn">
      <span class="icon-arrow-left"></span>
      {% trans "Go back" %}
    </a>
    <button class="btn btn-danger btn-large">
      <span class="icon-upload"></span>
      {% trans "Delete it!" %}
    </button>
  </div>
</form>

{% else %}
  <h2>{% trans "Remove" %} "{{ attachment.current_revision.get_filename }}"?</h2>
  <p class="lead">
    {% blocktrans with attachment.original_filename as filename trimmed %}
    You can remove a reference to a file, but it will retain its references on other articles.
    {% endblocktrans %}
  </p>
  <form method="POST" class="form-horizontal" id="attachment_form" enctype="multipart/form-data">
  {% wiki_form form %}
  <div class="form-actions">
    <a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}" class="btn">
      <span class="icon-arrow-left"></span>
      {% trans "Go back" %}
    </a>
    <button class="btn btn-danger btn-large">
      <span class="icon-upload"></span>
      {% trans "Remove reference" %}
    </button>
  </div>
</form>

{% endif %}

{% endblock %}

