{% extends "hp/base.html" %}
{% load i18n %}
{% load thumbnail %}
{% load staticfiles %}
{% load hp_tags %}

{% block title %}
{% trans "Hyperplateau : all videos" %}
{% endblock %}

{% block css_declaration %}
{{ block.super }}
<link rel="stylesheet" href="{% static "hp/css/videos.css" %}" type="text/css"/>
{% endblock %}


{% block body %}
{{block.super}}
<!-- all videos -->

<div class="main row">
    <h2>{% if search %}{% trans 'Results for:' %}&nbsp;{{search}}{% else %}{% trans 'All videos' %}{% endif %}</h2>
    <div class="row">
    {% for content in results %}
        <div class="video">
            <p>
                <a href="{% url hp.views.show_video_details content.iri_id %}">
                    {% thumbnail content.image "320x240" format="PNG" crop="center" as im %}<img src="{{ im.url }}" class="img_media" width="{{ im.width }}" height="{{ im.height }}" alt="{% trans 'open this media' %}" title="{% trans 'open this media' %}">{% endthumbnail %}
                </a>
            </p>
            <h3>
                <a href="{% url hp.views.show_video_details content.iri_id %}" title="{% trans 'open this media' %}" >{% if content.title|length > 69 %}{{content.title|slice:":69"}}...{% else %}{{content.title}}{% endif %}</a>
            </h3>
            <p>
                {% trans 'Duration:' %}
                <span class="video-duration">{{content.duration|str_duration:"::"}}</span>
            </p>
        </div>
        {% if forloop.counter|divisibleby:3 %}
    </div><div class="row">
        {% endif %}
    {% endfor %}
    </div>
    {% if results.has_other_pages %}
    <div class="pagination">
        <span class="step-links">
        {% if results.has_previous %}
            <a href="{% url hp.views.all_videos %}{{search_param_first}}">&lt;&lt;</a> <a href="{% url hp.views.all_videos %}?page={{ results.previous_page_number }}{{search_param}}">&lt;</a>
        {% else %}
            {{"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"|safe}}
        {% endif %}
        <span class="current">
            {{ results.number }}/{{ results.paginator.num_pages }}
        </span>
        {% if results.has_next %}
            <a href="{% url hp.views.all_videos %}?page={{ results.next_page_number }}{{search_param}}">&gt;</a> <a href="{% url hp.views.all_videos %}?page=last{{search_param}}">&gt;&gt;</a>
        {% else %}
            {{"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"|safe}}
        {% endif %}
        </span>
    </div>
    {% endif %}
</div>
{% endblock %}
