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

{% block porticus_content %}
<div class="row">
    <div class="tag-detail">
        <h3>Tag: {{ tag_object.name }}</h3>

        <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 %}
                    {% ifequal ressource.file_type 0 %}
                        <a href="{{ ressource.file_url }}" target="_blank">
                    {% else %}
                        <a href="{{ ressource.file_url }}">
                    {% endifequal %}
                {% else %}
                    <a href="{{ ressource.file.url }}" class="popup-link">
                {% endif %}
                
                {% if ressource.image %}
                    {% thumbnail ressource.image "105x105" as im %}<img src="{{ im.url }}" alt="">{% endthumbnail %}
                {% 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 %}
