{% extends "albums/_base.html" %} {% from "components/page_header.html" import page_header %} {% from "components/modal.html" import render_modal with context %} {% from "components/selection_bar.html" import selection_bar %} {% block title %}{{ _("%(album)s - Albums - Yaffo", album=selected.name) }}{% endblock %} {% macro render_share_album_form() %} {% if devices %} {# The checked devices ARE the devices this album is shared with: checking grants, unchecking revokes. The modal shows the truth and can undo itself. #}

{{ _("Checked devices can pull this album. They see its contents at the time they ask, so adding or removing photos changes what they get next time.") }}

{% else %}

{{ _("No paired devices yet. Pair a device on the Sharing tab first.") }}

{% endif %} {% endmacro %} {% macro render_edit_album_form() %}
{% endmacro %} {% block albums_content %} {% set delete_message = _('Delete %(album)s? The album and its contents list go away — the photos themselves are not deleted.', album=selected.name) %} {% set album_actions %} {{ _("Add photos") }} {% if items and not editing %} {{ _("Edit") }} {% endif %} {% endset %} {% call page_header(selected.name, actions=album_actions) %} {{ _("%(count)s photos", count=selected.item_count | format_integer) }} {% if selected.description %} — {{ selected.description }}{% endif %} {% if selected.is_shared %} {% for device_name in selected.shared_with %} {{ device_name }} {% endfor %} {% endif %} {% endcall %} {% if items %} {% if editing %} {# "Select all" here means every member of the album, not the rendered page. #} {% call selection_bar('album-selection', selection, _('Select all %(count)s photos', count=selected.item_count | format_integer)) %} {# Leaving edit mode drops the selection simply by dropping it from the URL. #} {{ _("Done") }} {% endcall %} {% endif %}
{% for media_item in items %}
{% if media_item.id == selected.cover_media_item_id %} {{ _("Cover") }} {% endif %} {% if media_item.media_type == 'video' %} {{ _('Video from %(date)s', date=media_item.date_taken | format_date('date')) }} {% else %} {{ _('Photo from %(date)s', date=media_item.date_taken | format_date('date')) }} {% endif %}
{% endfor %}
{% else %}

{{ _("This album is empty") }}

{{ _("Nothing has been added to it yet.") }}

{{ _("Add photos") }}
{% endif %} {# The selection rides the action's querystring (data-selection-form keeps it in step as cards are ticked), so the server reads the same parameters it rendered. #} {{ render_modal('editAlbumModal', _('Edit album'), url_for('albums_update_details', album_id=selected.id), render_edit_album_form, _('Save')) }} {{ render_modal('shareAlbumModal', _('Share album'), url_for('albums_share', album_id=selected.id), render_share_album_form, _('Share')) }} {% endblock %}