{# vim: set ts=2 et sts=2 sw=2: #}
{% from "layout/errorlist.html" import errorlist %}
{% if revision.reviewed %}
  <p><a href="{{ url('wiki.document_revisions', document.slug) }}">{{ _('Back to History') }}</a></p>
{% else %}
  <div id="actions">
    {{ errorlist(form) }}
    <form action="" method="post">
      {{ csrf() }}
      <input id="btn-approve" type="button" name="approve" value="{% if document.parent %}{{_('Approve Translation')  }}{% else %}{{ _('Approve Revision') }}{% endif %}">
      <input id="btn-reject" type="button" name="reject" value="{% if document.parent %}{{_('Reject Translation')  }}{% else %}{{ _('Reject Revision') }}{% endif %}">
      <a href="{{ url('wiki.document_revisions', document.slug) }}">{{ _('Cancel Review') }}</a>
    </form>

    <form id="approve-modal" class="kbox" action="" method="post" title="{% if document.parent %}{{ _('Accept this Translation') }}{% else %}{{ _('Accept this Revision') }}{% endif %}" data-modal="true" data-target="#btn-approve">
      {{ csrf() }}
      <p>
        {% if document.parent %}
          {% trans %}Thanks for taking the time to review these changes.
          Please consider sending a thank you to the person who submitted them.{% endtrans %}
        {% else %}
          {% trans %}Clicking Accept will make this version of the article live!
          Please pick the appropriate revision level below and consider sending
          a thank you to the person who submitted this.{% endtrans %}
        {% endif %}
      </p>
      {% if not document.parent %}
        {{ form.significance|safe }}
      {% endif %}
      <div class="message">
        <label for="id-approve-comment">{{ _('Leave a message for the contributor: <span class="optional">(optional)</span>')|safe }}</label>
        <textarea id="id-approve-comment" name="comment">{% if form.initial %}{{ form.initial.comment }}{% else %}{{ form.comment.data }}{% endif %}</textarea>
      </div>
      <input type="submit" name="approve" value="{{ _('Accept') }}">
      <a class="kbox-cancel" href="{{ url('wiki.document_revisions', document.slug) }}">{{ _('Cancel') }}</a>
    </form>

    <form id="reject-modal" class="kbox" action="" method="post" title="{% if document.parent %}{{ _('Reject this Translation') }}{% else %}{{ _('Reject this Revision') }}{% endif %}" data-modal="true" data-target="#btn-reject">
      {{ csrf() }}
      <p>
        {% trans %}Thanks for taking the time to review these changes. Please consider leaving a
        message for the person who submitted them explaining why they were rejected.{% endtrans %}
      </p>
      <div class="message">
        <label for="id-reject-comment">{{ _('Leave a message for the contributor: <span class="optional">(optional)</span>')|safe }}</label>
        <textarea id="id-reject-comment" name="comment">{% if form.initial %}{{ form.initial.comment }}{% else %}{{ form.comment.data }}{% endif %}</textarea>
      </div>
      <input type="submit" name="reject" value="{{ _('Reject') }}">
      <a class="kbox-cancel" href="{{ url('wiki.document_revisions', document.slug) }}">{{ _('Cancel') }}</a>
    </form>
  </div>
{% endif %}
