{% extends 'iconolab_base.html' %}

{% load staticfiles %}

{% load thumbnail %}

{% load iconolab_tags %}

{% load notifications_tags %}

{% block content %}
  <div id="user-profile-block" class="row" style="border: 1px solid gray; padding:15px;">
    <h3>{{profile_user.username}}: Annotations commentées <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_commented_annotations %}
       <h4 class="no-user-annotation"><small>Aucune annotation à afficher</small></h4>
    {% else %}
      <ul class="list-unstyled">
        {% for annotation_data in user_commented_annotations %}
          {% include "partials/user_pages/annotations_commented_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_commented_annotations.paginator.per_page == 5 %}active{% endif %}">
          <a {% if user_commented_annotations.paginator.per_page != 5 %}href="{% url 'user_commented' profile_user.id %}?&page=1&perpage=5"{% endif %}>5</a>
        </li>
        <li class="{% if user_commented_annotations.paginator.per_page == 10 %}active{% endif %}">
          <a {% if user_commented_annotations.paginator.per_page != 10 %}href="{% url 'user_commented' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
        </li>
        <li class="{% if user_commented_annotations.paginator.per_page == 25 %}active{% endif %}">
          <a {% if user_commented_annotations.paginator.per_page != 25 %}href="{% url 'user_commented' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
        </li>
        <li class="{% if user_commented_annotations.paginator.per_page == 100 %}active{% endif %}">
          <a {% if user_commented_annotations.paginator.per_page != 100 %}href="{% url 'user_commented' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
        </li>
      </ul>
      {% if user_commented_annotations.has_previous or user_commented_annotations.has_next %}
        <ul class="pagination pull-right">
          {% if user_commented_annotations.has_previous %}
          <li>
            <a href="{% url 'user_commented' profile_user.id %}?page={{user_commented_annotations.previous_page_number}}&perpage={{user_commented_annotations.paginator.per_page}}" aria-label="Précédent">
              <span aria-hidden="true">&laquo;</span>
            </a>
          </li>
          {% endif %}
          {% for page in user_commented_annotations.paginator.page_range %}
            <li id="page-link-{{page}}" class="pagination-link {% if page == user_commented_annotations.number %}active{% endif %}">
              <a {% if page != user_commented_annotations.number %}href="{% url 'user_commented' profile_user.id %}?page={{page}}&perpage={{user_commented_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
            </li>
          {% endfor %}
          
          {% if user_commented_annotations.has_next %}
          <li>
            <a href="{% url 'user_commented' profile_user.id %}?page={{user_commented_annotations.next_page_number}}&perpage={{user_commented_annotations.paginator.per_page}}" aria-label="Suivant">
              <span aria-hidden="true">&raquo;</span>
            </a>
          </li>
          {% endif %}
        </ul>
      {% endif %}
    {% endif %}
  </div>
{% endblock %}