{% extends "base.html" %}
{% load i18n %}
{% load static %}

{% block extrahead %}
<link rel="stylesheet" type="text/css" href="{% static 'css/gallery.css' %}">
{% endblock %}

{% block title %}{{ block.super }} - {{ title }}{% endblock %}

{% block content %}
<h1>{{ title }}</h1>

{% if user.is_authenticated and not perms.gallery.view %}
<div class="album_filter">
{% if show_public %}
<a href="?hide_public">{% trans "Hide public albums" %}</a>
{% else %}
<a href="?show_public">{% trans "Show public albums" %}</a>
{% endif %}
</div>
{% endif %}


<div class="photo_nav">
{# next_year has the "previous" class and vice-versa because album ordering is reversed #}
{% if next_year %}
<a href="{% url 'gallery:year' next_year.year %}" class="previous">{{ next_year.year }}</a>
{% endif %}
<a href="{% url 'gallery:index' %}" class="up">{{ title }}</a>
{% if previous_year %}
<a href="{% url 'gallery:year' previous_year.year %}" class="next">{{ previous_year.year }}</a>
{% endif %}
</div>

<h2>{{ year.year }}</h2>
{% for album in album_list %}
<h3 class="album_preview">
{{ album.display_name }}
<span class="album_count">{% blocktrans count album.photos_count as num_photos %}one photo{% plural %}{{ num_photos }} photos{% endblocktrans %}</span>
<span class="album_date">{{ album.date }}</span>
<span class="album_category">{% trans album.category %}</span>
</h3>
{% spaceless %}
<div class="photo_list">
{% for photo in album.preview %}
<a href="{{ album.get_absolute_url }}"><img src="{% url 'gallery:photo-resized' preset='thumb' pk=photo.pk %}" width="128" height="128" alt="{{ photo }}"></a>
{% empty %}
<p>{% trans "Sorry, you aren't authorized to view any photos in this album." %}</p>
{% endfor %}
</div>
{% endspaceless %}
{% empty %}
<p>{% trans "Sorry, you aren't authorized to view any albums." %}</p>
{% endfor %}

{% if is_paginated %}
<div class="album_page_list">
{% if page_obj.has_previous %}
<a href="{% url 'gallery:year' year.year %}?page={{ page_obj.previous_page_number }}">&larr;</a>
{% endif %}
{{ page_obj.number }} / {{ paginator.num_pages }}
{% if page_obj.has_next %}
<a href="{% url 'gallery:year' year.year %}?page={{ page_obj.next_page_number }}">&rarr;</a>
{% endif %}
</div>
{% endif %}

{% endblock %}
