2018-11-13 06:15:59 +00:00
|
|
|
{% macro create_root_album_card(view="grid") %}
|
2018-12-23 23:51:38 +00:00
|
|
|
{% set view = (view if view in ("list", "grid") else "grid") %}
|
2018-11-13 06:15:59 +00:00
|
|
|
{% set viewparam = "?view=list" if view == "list" else "" %}
|
|
|
|
{% if view == "list" %}
|
|
|
|
<div class="album_card album_card_list">
|
|
|
|
<div class="album_card_title">
|
|
|
|
<a href="/albums{{viewparam}}">Albums</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="album_card album_card_grid">
|
2018-12-23 23:36:40 +00:00
|
|
|
<a class="album_card_thumbnail" href="/albums"></a>
|
2018-11-13 06:15:59 +00:00
|
|
|
|
|
|
|
<div class="album_card_title">
|
|
|
|
<a href="/albums">Albums</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro create_album_card(album, view="grid", unlink_parent=none) %}
|
2018-12-23 23:51:38 +00:00
|
|
|
{% set view = (view if view in ("list", "grid") else "grid") %}
|
2018-11-13 06:15:59 +00:00
|
|
|
{% set viewparam = "?view=list" if view == "list" else "" %}
|
2018-12-23 23:51:38 +00:00
|
|
|
<div class="album_card album_card_{{view}}" data-id="{{album.id}}">
|
|
|
|
{% if view == "grid" %}
|
2018-12-22 07:44:11 +00:00
|
|
|
<a class="album_card_thumbnail" href="/album/{{album.id}}{{viewparam}}"></a>
|
2018-11-13 06:15:59 +00:00
|
|
|
<div class="album_card_tools">
|
|
|
|
{% if unlink_parent is not none %}
|
|
|
|
<button
|
|
|
|
class="remove_child_button button_with_confirm red_button"
|
|
|
|
data-onclick="api.albums.remove_child('{{unlink_parent.id}}', '{{album.id}}', common.refresh)"
|
|
|
|
data-prompt="Remove child?"
|
|
|
|
data-holder-class="remove_child_button"
|
|
|
|
data-confirm-class="red_button"
|
|
|
|
data-cancel-class="gray_button"
|
|
|
|
>Unlink
|
|
|
|
</button>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-12-23 23:51:38 +00:00
|
|
|
<div class="album_card_title">
|
|
|
|
<a href="/album/{{album.id}}{{viewparam}}">{{album.display_name}}</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="album_card_metadata">
|
2019-03-16 20:07:29 +00:00
|
|
|
{% set child_count = album.get_children()|length %}
|
|
|
|
{% set photo_count = album.sum_photos(recurse=False) %}
|
|
|
|
<span class="album_card_child_count" title="{{child_count}} children">{{child_count}}</span>
|
2018-12-23 23:51:38 +00:00
|
|
|
{{-' | '-}}
|
2019-03-16 20:07:29 +00:00
|
|
|
<span class="album_card_photo_count" title="{{photo_count}} photos">{{photo_count}}</span>
|
2018-12-23 23:51:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-11-13 06:15:59 +00:00
|
|
|
{% endmacro %}
|