{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "wiki/base.html" %}
{% from "wiki/includes/sidebar_modules.html" import document_tabs %}
{% set title = _('Review Revision {id} | {document}')|f(document=document.title, id=revision.id) %}
{% block title %}{{ page_title(title) }}{% endblock %}
{% set crumbs = [(url('wiki.category', document.category), document.get_category_display()),
                 (document.get_absolute_url(), document.title), (None, 'Review Revision')] %}
{% set classes = 'review' %}
{% block bodyclass %}review{% endblock %}

{% block content %}
<section id="content">
  <div class="wrap">
    <div id="content-main" class="full">
  <article id="review-revision" role="main">
    <h1>{{ _('Review Revision of {title}')|f(title=document.title) }}</h1>
    <p>{{ _('Reviewing Revision {id} by {user}')|f(id=revision.id, user=revision.creator) }}.
    <a href="{{ url('wiki.document_revisions', document.slug) }}">{{ _('Back to History') }}</a></p>

    {% if revision.reviewed %}
      <p>
        {{ _('This revision was already reviewed by {user} on {date}.')|fe(user=revision.reviewer, date=datetimeformat(revision.reviewed, format='longdatetime')) }}
      </p>
    {% elif document.current_revision %}
      <details class="h2" open="open">
        <summary>{{ _('Submitted Revision Changes') }}</summary>
        {% with revision_from = document.current_revision, revision_to = revision, revision_from_header = _('Current public revision:'), revision_to_header = _('Submitted revision:') %}
          {% include 'wiki/includes/revision_diff.html' %}
        {% endwith %}
      </details>
      <details class="h2">
        <summary>{{ _('Revision Source') }}</summary>
        <div id="doc-source">
          <textarea readonly="readonly">{{ revision.content }}</textarea>
        </div>
      </details>
      <details class="h2">
        <summary>{{ _('Revision Content') }}</summary>
        <div id="doc-content">
          {{ revision.content_parsed|safe }}
        </div>
      </details>
    {% else %}
      <p>{{ _('This document does not have a current revision.') }}</p>
      <h3>{{ _('Keywords:') }}</h3>
      <div id="revision-keywords">
        {{ revision.keywords }}
      </div>
      <h3>{{ _('Search results summary:') }}</h3>
      <div id="revision-summary">
        {{ revision.summary }}
      </div>
      <h3>{{ _('Revision source:') }}</h3>
      <div id="revision-content">
        <pre>{{ revision.content }}</pre>
      </div>
      <h3>{{ _('Revision rendered html:') }}</h3>
      <div id="revision-html">
        <div id="doc-content">
          {{ revision.content_parsed|safe }}
        </div>
      </div>
    {% endif %}

    {% include 'wiki/includes/review_form.html' %}
  </article>
    </div>
   </div>
</section>
{% endblock %}

{% block side_top %}
  {{ document_tabs(document, document.parent, user, '', settings) }}
{% endblock %}

{% block side %}
  {% include 'wiki/includes/support_for_selectors.html' %}
{% endblock %}
