{% extends 'iconolab/user_base.html' %}

{% load staticfiles %}

{% load thumbnail %}

{% load iconolab_tags %}

{% load notifications_tags %}

{% block user_content %}
  <div id="user-profile-block">
    <h4>Révisions en attente de validation</h4>
    <table class="table">
      <thead>
        <th></th>
        <th>Titre</th>
        <th>Auteur</th>
        <th>Date</th>
        <th></th>
      </thead>
      <tbody>
      {% for revision in awaiting_revisions %}
      <tr>
        <td>
          <div class="fragment-container" style="position: relative">
            {% thumbnail revision.annotation.image.media "100x100" crop=False as im %}
              <a href="{% url 'revision_detail' collection.name revision.annotation.image.image_guid revision.annotation.annotation_guid revision.revision_guid %}">
                <img v-el:small-image src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />
                <svg width="{{ im.width }}" height="{{ im.height }}" version="1.1" style="position:absolute; top:0px; left: 0px">
                  <g transform="matrix({% transform_matrix im_width=im.width im_height=im.height max_x=100 max_y=100 %})">
                    <path d="{{ revision.fragment|clean_path }}" opacity="0.7" fill="orange"></path>
                  </g>
                </svg>
              </a>
            {% endthumbnail %}
          </div>
        </td>
        <td>{{ revision.title }}</td>
        <td>{{ revision.author }}</td>
        <td>{{ revision.created|date:'d-m-Y H:i:s' }}</td>
        <td>
          <span class="pull-right">
            {% if revision.parent_revision == revision.annotation.current_revision %}
            <a class="btn btn-sm btn-success" href="{% url 'annotation_merge' collection.name revision.annotation.image.image_guid
            revision.annotation.annotation_guid revision.revision_guid %}?auto_accept=True"><span class="glyphicon glyphicon-ok"></span> Accepter</a>
            {% endif %}
            <a class="btn btn-sm btn-danger" href="{% url 'annotation_merge' collection.name revision.annotation.image.image_guid revision.annotation.annotation_guid revision.revision_guid %}?auto_reject=True"><span class="glyphicon glyphicon-remove"></span> Refuser</a>
          </span>
        </td>
      </tr>
      {% endfor %}
      </tbody>
    </table>
  </div>
{% endblock %}
