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

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

{% block wiki_contents_tab %}

<h2>{% trans "Replace" %} "{{ attachment.current_revision.get_filename }}"</h2>
{% if attachment.articles.count > 1 %}
<p class="lead">
  {% blocktrans with attachment.original_filename as filename trimmed %}
  Replacing an attachment means adding a new file that will be used in its place. All references to the file will be replaced by the one you upload and the file will be downloaded as <strong>{{ filename }}</strong>. Please note that this attachment is in use on other articles, you may distort contents. However, do not hestitate to take advantage of this and make replacements for the listed articles where necessary. This way of working is more efficient....
  {% endblocktrans %}
</p>
<h3>{% trans "Articles using" %} {{ attachment.current_revision.get_filename }}</h3>
<ul>
  {% for a in attachment.articles.all %}<li>{{ a.current_revision.title }}</li>{% endfor %}
</ul>
<hr />
{% else %}
<p class="lead">
  {% blocktrans with attachment.original_filename as filename trimmed %}
  Replacing an attachment means adding a new file that will be used in its place. All references to the file will be replaced by the one you upload and the file will be downloaded as <strong>{{ filename }}</strong>.
  {% endblocktrans %}
</p>
{% endif %}

<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-primary">
      <span class="icon-upload"></span>
      {% trans "Upload replacement" %}
    </button>
  </div>
</form>
  
{% endblock %}
