{% extends 'iconolab_base.html' %}

{% load staticfiles %}

{% load thumbnail %}

{% load iconolab_tags %}

{% block content %}
  <div id="collection-summary" class="row collection-summary">
    <h1 class="collection-home-title text-center"><small>Fonds Iconolab</small> {{ collection.verbose_name }}</h1>
    <div class="col-md-3 pull-left">
      {% thumbnail collection.image "250x250" crop=False as im %}
        <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
      {% endthumbnail %}
    </div>
    <div class="col-md-9 description-container">
      
      <p id="collection-description-short-{{collection.name}}" class="text-justify collection-description"> 
        {{collection.description | safe}} 
        {% if collection.complete_description %}<a id="show-complete-{{collection.name}}" class="show-complete-link" @click="showCompleteDescription('{{collection.name}}')"> Voir plus</a>{% endif %}
      </p>
      <p id="collection-description-complete-{{collection.name}}" class="text-justify collection-description-complete">
        {{collection.complete_description | safe}} 
        <a id="hide-complete-{{collection.name}}" class="hide-complete-link" @click="hideCompleteDescription('{{collection.name}}')"> Voir moins</a>
      </p>
    </div>
  </div>
  <div id="collection-tabs" class="row tab-selector">
    <div class="col-md-12">
      <ul class="nav nav-tabs">
        <li id="tab-items" role="presentation" class="{% if active_list == 'items' %}active{% endif %}"><a class="collection-home-tab" id="show-items" @click="switchTab('items')">Objets du fonds {{collection.verbose_name}}</a></li>
        <li id="tab-contribution" role="presentation" class="pull-right {% if active_list == 'contributions' %}active{% endif %}"><a class="collection-home-tab" id="show-contribution" @click="switchTab('contribution')">Appels à contribution</a></li>
        <li id="tab-revised" role="presentation" class="pull-right {% if active_list == 'revised' %}active{% endif %}"><a class="collection-home-tab" id="show-revised" @click="switchTab('revised')">Annotations les plus révisées</a></li>
        <li id="tab-recent" role="presentation" class="pull-right {% if active_list == 'recent' %}active{% endif %}"><a class="collection-home-tab" id="show-recent" @click="switchTab('recent')">Annotations récentes</a></li>
      </ul>
    </div>
  </div>
  <div class="row">
    <div id="list-recent" class="recent-ann-wrapper collection-home-block col-md-12 {% if active_list == 'recent' %}selected{% endif %}">
      {% include "partials/image_annotations_list.html" with annotation_list=recent_list %}
      {% if recent_list %}
        <ul class="pagination pull-right recent-perpage" style="margin-left: 15px;">
          <li class="active pagination-label"><a>Annotations par page : </a></li>
          <li class="{% if recent_list.paginator.per_page == 5 %}active{% endif %}">
            <a {% if recent_list.paginator.per_page != 5 %}href="{% url 'collection_home' collection_name %}?show=recent&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page=1&recent_perpage=5&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>5</a>
          </li>
          <li class="{% if recent_list.paginator.per_page == 10 %}active{% endif %}">
            <a {% if recent_list.paginator.per_page != 10 %}href="{% url 'collection_home' collection_name %}?show=recent&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page=1&recent_perpage=10&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>10</a>
          </li>
          <li class="{% if recent_list.paginator.per_page == 25 %}active{% endif %}">
            <a {% if recent_list.paginator.per_page != 25 %}href="{% url 'collection_home' collection_name %}?show=recent&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page=1&recent_perpage=25&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>25</a>
          </li>
          <li class="{% if recent_list.paginator.per_page == 100 %}active{% endif %}">
            <a {% if recent_list.paginator.per_page != 100 %}href="{% url 'collection_home' collection_name %}?show=recent&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page=1&recent_perpage=100&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>100</a>
          </li>
        </ul>
        {% if recent_list.has_previous or recent_list.has_next %}
          <ul class="pagination pull-right recent-pagination">
            {% if recent_list.has_previous %}
            <li>
              <a href="{% url 'collection_home' collection_name %}?show=recent&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_list.previous_page_number}}&recent_perpage={{recent_list.paginator.per_page}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}" aria-label="Précédent">
                <span aria-hidden="true">&laquo;</span>
              </a>
            </li>
            {% endif %}
            
            {% for page in recent_list.paginator.page_range %}
              <li id="page-link-{{page}}" class="pagination-link {% if page == recent_list.number %}active{% endif %}">
                <a {% if page != revised_list.number %}href="{% url 'collection_home' collection_name %}?show=recent&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{page}}&recent_perpage={{recent_list.paginator.per_page}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>{{page}}</a>
              </li>
            {% endfor %}
            
            {% if recent_list.has_next %}
            <li>
              <a href="{% url 'collection_home' collection_name %}?show=recent&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_list.next_page_number}}&recent_perpage={{recent_list.paginator.per_page}}&revised_page={{revised_page}}&revised_perpage={{revised_.perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}" aria-label="Suivant">
                 <span aria-hidden="true">&raquo;</span>
              </a>
            </li>
            {% endif %}
          </ul>
        {% endif %}
      {% endif %}
    </div>
  </div>
  <div class="row">
    <div id="list-revised" class="revised-ann-wrapper collection-home-block col-md-12 {% if active_list == 'revised' %}selected{% endif %}">
      {% include "partials/image_annotations_list.html" with annotation_list=revised_list %}
      {% if revised_list %}
        <ul class="pagination pull-right revised-perpage" style="margin-left: 15px;">
          <li class="active pagination-label"><a>Annotations par page : </a></li>
          <li class="{% if revised_list.paginator.per_page == 5 %}active{% endif %}">
            <a {% if revised_list.paginator.per_page != 5 %}href="{% url 'collection_home' collection_name %}?show=revised&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page=1&revised_perpage=5&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>5</a>
          </li>
          <li class="{% if revised_list.paginator.per_page == 10 %}active{% endif %}">
            <a {% if revised_list.paginator.per_page != 10 %}href="{% url 'collection_home' collection_name %}?show=revised&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page=1&revised_perpage=10&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>10</a>
          </li>
          <li class="{% if revised_list.paginator.per_page == 25 %}active{% endif %}">
            <a {% if revised_list.paginator.per_page != 25 %}href="{% url 'collection_home' collection_name %}?show=revised&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page=1&revised_perpage=25&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>25</a>
          </li>
          <li class="{% if revised_list.paginator.per_page == 100 %}active{% endif %}">
            <a {% if revised_list.paginator.per_page != 100 %}href="{% url 'collection_home' collection_name %}?show=revised&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page=1&revised_perpage=100&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>100</a>
          </li>
        </ul>
        {% if revised_list.has_previous or revised_list.has_next %}
          <ul class="pagination pull-right revised-pagination">
            {% if revised_list.has_previous %}
            <li>
              <a href="{% url 'collection_home' collection_name %}?show=revised&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_list.previous_page_number}}&revised_perpage={{revised_list.paginator.per_page}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}" aria-label="Précédent">
                <span aria-hidden="true">&laquo;</span>
              </a>
            </li>
            {% endif %}
            
            {% for page in revised_list.paginator.page_range %}
              <li id="page-link-{{page}}" class="pagination-link {% if page == revised_list.number %}active{% endif %}">
                <a {% if page != revised_list.number %}href="{% url 'collection_home' collection_name %}?show=revised&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{page}}&revised_perpage={{revised_list.paginator.per_page}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>{{page}}</a>
              </li>
            {% endfor %}
            
            {% if revised_list.has_next %}
            <li>
              <a href="{% url 'collection_home' collection_name %}?show=revised&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_list.next_page_number}}&revised_perpage={{revised_list.paginator.per_page}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}" aria-label="Suivant">
                 <span aria-hidden="true">&raquo;</span>
              </a>
            </li>
            {% endif %}
          </ul>
        {% endif %}
      {% endif %}
    </div>
  </div>
  <div class="row">
    <div id="list-contribution" class="contributions-ann-wrapper collection-home-block col-md-12 {% if active_list == 'contributions' %}selected{% endif %}">
      {% include "partials/image_annotations_list.html" with annotation_list=contributions_list %}
      {% if contributions_list %}
        <ul class="pagination pull-right contributions-perpage" style="margin-left: 15px;">
          <li class="active pagination-label"><a>Annotations par page : </a></li>
          <li class="{% if contributions_list.paginator.per_page == 5 %}active{% endif %}">
            <a {% if contributions_list.paginator.per_page != 5 %}href="{% url 'collection_home' collection_name %}?show=contributions&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page=1&contributions_perpage=5"{% endif %}>5</a>
          </li>
          <li class="{% if contributions_list.paginator.per_page == 10 %}active{% endif %}">
            <a {% if contributions_list.paginator.per_page != 10 %}href="{% url 'collection_home' collection_name %}?show=contributions&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page=1&contributions_perpage=10"{% endif %}>10</a>
          </li>
          <li class="{% if contributions_list.paginator.per_page == 25 %}active{% endif %}">
            <a {% if contributions_list.paginator.per_page != 25 %}href="{% url 'collection_home' collection_name %}?show=contributions&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page=1&contributions_perpage=25"{% endif %}>25</a>
          </li>
          <li class="{% if contributions_list.paginator.per_page == 100 %}active{% endif %}">
            <a {% if contributions_list.paginator.per_page != 100 %}href="{% url 'collection_home' collection_name %}?show=contributions&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page=1&contributions_perpage=100"{% endif %}>100</a>
          </li>
        </ul>
        {% if contributions_list.has_previous or contributions_list.has_next %}
          <ul class="pagination pull-right contributions-pagination">
            {% if contributions_list.has_previous %}
            <li>
              <a href="{% url 'collection_home' collection_name %}?show=contributions&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_list.previous_page_number}}&contributions_perpage={{contributions_list.paginator.per_page}}" aria-label="Précédent">
                <span aria-hidden="true">&laquo;</span>
              </a>
            </li>
            {% endif %}
            
            {% for page in contributions_list.paginator.page_range %}
              <li id="page-link-{{page}}" class="pagination-link {% if page == contributions_list.number %}active{% endif %}">
                <a {% if page != contributions_list.number %}href="{% url 'collection_home' collection_name %}?show=contributions&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{page}}&contributions_perpage={{contributions_list.paginator.per_page}}"{% endif %}>{{page}}</a>
              </li>
            {% endfor %}
            
            {% if contributions_list.has_next %}
            <li>
             <a href="{% url 'collection_home' collection_name %}?show=contributions&items_page={{items_page}}&items_perpage={{items_perpage}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_list.next_page_number}}&contributions_perpage={{contributions_list.paginator.per_page}}" aria-label="Suivant">
                <span aria-hidden="true">&raquo;</span>
              </a>
            </li>
            {% endif %}
          </ul>
        {% endif %}
      {% endif %}
    </div>
  </div>
  <div class="row">
    <div id="list-items" class="collection-home-block col-md-12 text-center {% if active_list == 'items' %}selected{% endif %}">
      <ul class="image-list-wrapper list-inline">
        
        {% for item in items_list %}
          <li class="image-list-li small-image-wrapper panel panel-default">
            <div class="object-infos text-center" style="margin-top: 10px;">
               <a class="btn btn-default btn-xs collection-home-item-btn" href="{% url 'item_detail' collection_name item.item_guid %}"><i class="fa fa-eye"></i> Détail de l'objet</a>
            </div>
            {% include "partials/item_images_preview.html" with item=item %}
          </li>
        {% endfor %}
      </ul>
      <ul class="pagination pull-right items-perpage" style="margin-left: 15px;">
        <li class="active pagination-label"><a>Objets par page : </a></li>
        <li class="{% if items_list.paginator.per_page == 6 %}active{% endif %}">
          <a {% if items_list.paginator.per_page != 6 %}href="{% url 'collection_home' collection_name %}?show=items&items_page=1&items_perpage=6&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>6</a>
        </li>
        <li class="{% if items_list.paginator.per_page == 12 %}active{% endif %}">
          <a {% if items_list.paginator.per_page != 12 %}href="{% url 'collection_home' collection_name %}?show=items&items_page=1&items_perpage=12&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>12</a>
        </li>
        <li class="{% if items_list.paginator.per_page == 48 %}active{% endif %}">
          <a {% if items_list.paginator.per_page != 48 %}href="{% url 'collection_home' collection_name %}?show=items&items_page=1&items_perpage=48&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>48</a>
        </li>
        <li class="{% if items_list.paginator.per_page == 256 %}active{% endif %}">
          <a {% if items_list.paginator.per_page != 256 %}href="{% url 'collection_home' collection_name %}?show=items&items_page=1&items_perpage=256&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>256</a>
        </li>
      </ul>
      {% if items_list.has_previous or items_list.has_next %}
        <ul class="pagination pull-right items-pagination">
          {% if items_list.has_previous %}
          <li>
            <a href="{% url 'collection_home' collection_name %}?show=items&items_page={{items_list.previous_page_number}}&items_perpage={{items_list.paginator.per_page}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}" aria-label="Précédent">
              <span aria-hidden="true">&laquo;</span>
            </a>
          </li>
          {% endif %}
          
          {% for page in items_list.paginator.page_range %}
            <li id="page-link-{{page}}" class="pagination-link {% if page == items_list.number %}active{% endif %}">
              <a {% if page != items_list.number %}href="{% url 'collection_home' collection_name %}?show=items&items_page={{page}}&items_perpage={{items_list.paginator.per_page}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}"{% endif %}>{{page}}</a>
            </li>
          {% endfor %}
          
          {% if items_list.has_next %}
          <li>
           <a href="{% url 'collection_home' collection_name %}?show=items&items_page={{items_list.next_page_number}}&items_perpage={{items_list.paginator.per_page}}&recent_page={{recent_page}}&recent_perpage={{recent_perpage}}&revised_page={{revised_page}}&revised_perpage={{revised_perpage}}&contributions_page={{contributions_page}}&contributions_perpage={{contributions_perpage}}" aria-label="Suivant">
             <span aria-hidden="true">&raquo;</span>
            </a>
          </li>
          {% endif %}
        </ul>
      {% endif %}
    </div>
  </div>
{% endblock %}

{% block footer_js %}
<script>
  _descrVue = new Vue(iconolab.DescriptionViewer);
  _descrVue.$mount("#collection-summary");
  _tabsVue = new Vue(iconolab.TabSelector);
  _tabsVue.$mount("#collection-tabs");
</script>
{% endblock %}