{% extends "porticus/base.html" %}
{% load i18n fb_versions tagging_tags %}

{% block porticus_content %}
<div class="row">
    <div class="tag-detail">
        {% if ressources_tags %}
            <p><a href="{% url 'porticus:album-detail' gallery_slug=gallery_object.slug album_slug=album_object.slug %}">Retour</a></p>
            <p class="cloud-tags text-center">
                {% for tag in ressources_tags %}
                    <a class="label radius tag-size-{{ tag.font_size }}{% if tag.name == tag_object.name %} active{% endif %}" href="{% url 'porticus:album-tag' gallery_slug=gallery_object.slug album_slug=album_object.slug tag=tag.name %}">{{ tag.name }}</a>
                {% endfor %}
            </p>
        {% endif %}

        <div class="album-grid-simple equal-heights">{% for ressource in ressource_list %}
        {% spaceless %}
            <div class="large-3 columns item equalized-item{% if forloop.last %} end{% endif %}">
                {% if ressource.file_url %}
                    {% if ressource.get_file_kind == 'binary' %}
                        <a href="{{ ressource.file_url }}" target="_blank">
                    {% else %}
                        <a href="{{ ressource.file_url }}">
                    {% endif %}
                {% else %}
                    <a href="{{ ressource.file.url }}" class="popup-link" target="_blank">
                {% endif %}
                
                {% if ressource.image %}
                    {% version_object ressource.image 'thumbnail' as image_thumb %}
                    <img src="{{ image_thumb.url }}" alt="">
                {% endif %}
                
                    <h4>{{ ressource.name }}</h4>
                </a>
                
                {% if ressource.description %}
                <div class="description">
                    <p>{{ ressource.description }}</p>
                </div>
                {% endif %}
            </div>
        {% endspaceless %}
        {% endfor %}</div>
        
        {% if is_paginated %}<ul class="pagination right">
            {% if page_obj.has_previous %}<li class="arrow"><a href="?page={{ page_obj.previous_page_number }}">&laquo;</a></li>{% endif %}
            {% for item in paginator.page_range %}
            <li{% if item == page_obj.number %} class="current"{% endif %}><a href="?page={{ item }}">{{ item }}</a></li>
            {% endfor %}
            {% if page_obj.has_next %}<li class="arrow"><a href="?page={{ page_obj.next_page_number }}">&raquo;</a></li>{% endif %}
        </ul>{% endif %}
    </div>
</div>
{% endblock %}
