Unify album_card and root_album_card macros.
This commit is contained in:
parent
3bd8fe6392
commit
fcf7a460b2
2 changed files with 14 additions and 23 deletions
|
@ -255,7 +255,7 @@ ALBUM_ID = undefined;
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<h3>1 Parent</h3>
|
<h3>1 Parent</h3>
|
||||||
{{album_card.create_root_album_card(view=view)}}
|
{{album_card.create_album_card("root", view=view)}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,13 @@
|
||||||
{% macro create_root_album_card(view="grid") %}
|
|
||||||
{% set view = (view if view in ("list", "grid") else "grid") %}
|
|
||||||
{% 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">
|
|
||||||
<a class="album_card_thumbnail" href="/albums"></a>
|
|
||||||
|
|
||||||
<div class="album_card_title">
|
|
||||||
<a href="/albums">Albums</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
{% macro create_album_card(album, view="grid", unlink_parent=none) %}
|
{% macro create_album_card(album, view="grid", unlink_parent=none) %}
|
||||||
{% set view = (view if view in ("list", "grid") else "grid") %}
|
{% set view = (view if view in ("list", "grid") else "grid") %}
|
||||||
{% set viewparam = "?view=list" if view == "list" else "" %}
|
{% set viewparam = "?view=list" if view == "list" else "" %}
|
||||||
<div class="album_card album_card_{{view}}" data-id="{{album.id}}">
|
<div class="album_card album_card_{{view}}" data-id="{{album.id}}">
|
||||||
{% if view == "grid" %}
|
{% if album == "root" %}
|
||||||
|
<a class="album_card_thumbnail" href="/albums{{viewparam}}"></a>
|
||||||
|
{% else %}
|
||||||
<a class="album_card_thumbnail" href="/album/{{album.id}}{{viewparam}}"></a>
|
<a class="album_card_thumbnail" href="/album/{{album.id}}{{viewparam}}"></a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="album_card_tools">
|
<div class="album_card_tools">
|
||||||
{% if unlink_parent is not none %}
|
{% if unlink_parent is not none %}
|
||||||
<button
|
<button
|
||||||
|
@ -37,17 +21,24 @@
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
<div class="album_card_title">
|
<div class="album_card_title">
|
||||||
|
{% if album == "root" %}
|
||||||
|
<a href="/albums{{viewparam}}">Albums</a>
|
||||||
|
{% else %}
|
||||||
<a href="/album/{{album.id}}{{viewparam}}">{{album.display_name}}</a>
|
<a href="/album/{{album.id}}{{viewparam}}">{{album.display_name}}</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="album_card_metadata">
|
<div class="album_card_metadata">
|
||||||
|
{% if album == "root" %}
|
||||||
|
{% else %}
|
||||||
{% set child_count = album.get_children()|length %}
|
{% set child_count = album.get_children()|length %}
|
||||||
{% set photo_count = album.sum_photos(recurse=False) %}
|
{% set photo_count = album.sum_photos(recurse=False) %}
|
||||||
<span class="album_card_child_count" title="{{child_count}} children">{{child_count}}</span>
|
<span class="album_card_child_count" title="{{child_count}} children">{{child_count}}</span>
|
||||||
{{-' | '-}}
|
{{-' | '-}}
|
||||||
<span class="album_card_photo_count" title="{{photo_count}} photos">{{photo_count}}</span>
|
<span class="album_card_photo_count" title="{{photo_count}} photos">{{photo_count}}</span>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
Loading…
Reference in a new issue