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

{% block title %}
    {% if view_user %}
        {% trans "Albums for user" %} {{ view_user.username }}
    {% else %}
        {% trans "All albums" %}
    {% endif %}
{% endblock %}

{% block breadcrumb %}
    {{ block.super }}  &#187;
    {% if view_user %}
        <a href="{% url imagestore:index %}">{% trans "Gallery" %}</a> &#187;
    {% endif %}
{% endblock %}

{% block imagestore-info %}
    {% if view_user and IMAGESTORE_SHOW_USER %}
        {% with view_user.get_profile as profile %}
            {% include "imagestore/user_info.html" %}
        {% endwith %}
    {% endif %}
{% endblock %}

{% block imagestore-related %}
    {% include "imagestore/tag-cloud.html" %}
{% endblock %}

{% block content %}
    <h1>{% if view_user %}
        {% trans "Albums for user" %} {{ view_user.username }}
    {% else %}
        {% trans "All albums" %}
    {% endif %}</h1>
    <div class='album-list'>
        {% include "imagestore/pagination.html" %}
        {% for album in album_list %}
            {% if album.get_head  or album.user == request.user %}
            <div class='album'>
                <div class='album-head'>
                    <a href="{{ album.get_absolute_url }}">
                    {% if album.get_head %}
                        {% thumbnail album.get_head.image "150x150" crop='center' as album_head %}
                            <img class="preview" {% if album.name %} alt="{{ album.name }}" {% endif %} src="{{ album_head.url }}">
                        {% endthumbnail %}
                    {% else %}
                        [{% trans "Empty album" %}]
                    {% endif %}
                    </a>
                </div>

                <div class="album-name"><a href="{{ album.get_absolute_url }}">{{ album.name }}</a></div>
                {% if not view_user and IMAGESTORE_SHOW_USER %}
                    <div class="album-user">
                        {% trans "user" %}: <a href="{% url imagestore:user username=album.user.username %}">{{ album.user.username }}</a>
                    </div>
                {% endif %}
            </div>
            {% endif %}
        {% endfor %}
        {% include "imagestore/pagination.html" %}
    </div>
{% endblock %}