{% load thumbnail %}
{% load iconolab_tags %}

<ul class="annotation-list-wrapper list-inline">
    {% if header %}
	<h4><strong>Annotations de l'image</strong></h4>
    {% endif %}
    
    
    {% if not annotation_list %}
        <h3 class="text-center"><small>Aucune annotation à afficher</small></p>
    {% else %}
        <table class="table table-condensed">
          <thead>
            <th></th>
            <th>Titre</th>
            <th>Auteur</th>
            <th>Créée le</th>
            <th>Révisée le</th>
            <th>Contributeurs</th>
            <th>Statistiques</th>
          </thead>
          {% for annotation in annotation_list %}
          <tr>
            <td>
              <div class="fragment-container" style="position: relative">
                {% thumbnail annotation.image.media "150x150" crop=False as im %}
                  <a href="{% url 'annotation_detail' collection_name annotation.image.image_guid annotation.annotation_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="{{ annotation.current_revision.fragment|clean_path }}" opacity="0.7" fill="orange"></path>
                      </g>
                    </svg>
                  </a>
                {% endthumbnail %}
              </div>
            </td>
            <td>{{ annotation.current_revision.title }}</td>
            <td><a href="{% url 'user_home' annotation.author.id %}" style="color:#000000">{{ annotation.author }}</a></td>
            <td>{{ annotation.created|date:'d-m-Y' }}</td>
            <td>{{ annotation.current_revision.created|date:'d-m-Y' }}</td>
            <td>
              {% for contributor in annotation.stats.contributors.all %}
                  <a href="{% url 'user_home' contributor.id %}" style="color:#000000">{{ contributor.username }}</a>{% if not forloop.last %}, {% endif %}
              {% endfor %}
            </td>
            <td>
                {% include "partials/annotation_stats_panel.html" with annotation=annotation %}  
            </td>
          </tr>
          {% endfor %}
        </table>
    {% endif %}
</ul>