{% extends 'iconolab_base.html' %}

{% load staticfiles %}

{% load thumbnail %}

{% load iconolab_tags %}

{% load notifications_tags %}

{% block content %}
  <div id="user-profile-block" class="row">
    <h3>{{profile_user.username}}: Toutes les contributions <a class="btn btn-default" href="{% url 'user_home' profile_user.id %}"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> Retour au profil</a></h3>
    <hr>
    {% if not user_contributed_annotations %}
       <h4 class="no-user-annotation"><small>Aucune annotation à afficher</small></h4>
    {% else %}
      <ul class="list-unstyled">
        {% for annotation_data in user_contributed_annotations %}
           {% include "partials/user_pages/annotations_contributed_panel.html" with annotation_data=annotation_data user=profile_user with_stats=True large_image=True %}
        {% endfor %}
      </ul>
      <ul class="pagination pull-right img-ann-{{image.obj.guid}}-perpage" style="margin-left: 15px;">
        <li class="active pagination-label"><a>Annotations par page : </a></li>
        <li class="{% if user_contributed_annotations.paginator.per_page == 5 %}active{% endif %}">
          <a {% if user_contributed_annotations.paginator.per_page != 5 %}href="{% url 'user_contributed' profile_user.id %}?&page=1&perpage=5"{% endif %}>5</a>
        </li>
        <li class="{% if user_contributed_annotations.paginator.per_page == 10 %}active{% endif %}">
          <a {% if user_contributed_annotations.paginator.per_page != 10 %}href="{% url 'user_contributed' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
        </li>
        <li class="{% if user_contributed_annotations.paginator.per_page == 25 %}active{% endif %}">
          <a {% if user_contributed_annotations.paginator.per_page != 25 %}href="{% url 'user_contributed' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
        </li>
        <li class="{% if user_contributed_annotations.paginator.per_page == 100 %}active{% endif %}">
          <a {% if user_contributed_annotations.paginator.per_page != 100 %}href="{% url 'user_contributed' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
        </li>
      </ul>
      {% if user_contributed_annotations.has_previous or user_contributed_annotations.has_next %}
        <ul class="pagination pull-right">
          {% if user_contributed_annotations.has_previous %}
          <li>
            <a href="{% url 'user_contributed' profile_user.id %}?page={{user_contributed_annotations.previous_page_number}}&perpage={{user_contributed_annotations.paginator.per_page}}" aria-label="Précédent">
              <span aria-hidden="true">&laquo;</span>
            </a>
          </li>
          {% endif %}
          {% for page in user_contributed_annotations.paginator.page_range %}
            <li id="page-link-{{page}}" class="pagination-link {% if page == user_contributed_annotations.number %}active{% endif %}">
              <a {% if page != user_contributed_annotations.number %}href="{% url 'user_contributed' profile_user.id %}?page={{page}}&perpage={{user_contributed_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
            </li>
          {% endfor %}

          {% if user_contributed_annotations.has_next %}
          <li>
            <a href="{% url 'user_contributed' profile_user.id %}?page={{user_contributed_annotations.next_page_number}}&perpage={{user_contributed_annotations.paginator.per_page}}" aria-label="Suivant">
              <span aria-hidden="true">&raquo;</span>
            </a>
          </li>
          {% endif %}
        </ul>
      {% endif %}
    {% endif %}
  </div>
{% endblock %}
