etiquette/templates/photo_card.html
Ethan Dalool c80e2003ff checkpoint
add photo and search css for narrow screens; incorporate new expressionmatch kit; entry_with_history cursor moves to end; albums indicate total filesize; etc
2017-02-24 22:07:59 -08:00

67 lines
2.1 KiB
HTML

{% set thumbnails =
{
"audio": "audio",
"txt": "txt",
"svg": "svg",
"video": "video",
"7z": "archive",
"gz": "archive",
"rar": "archive",
"tar": "archive",
"zip": "archive",
}
%}
{% macro create_photo_card(photo, view="grid") %}
{% if view == "list" %}
<div class="photo_card_list">
<a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a>
<a target="_blank" href="/file/{{photo.id}}.{{photo.extension}}">{{photo.bytestring()}}</a>
</div>
{% else %}
<div class="photo_card_grid">
<div class="photo_card_grid_thumb">
<a target="_blank" href="/photo/{{photo.id}}">
<img height="150"
{% if photo.thumbnail %}
src="/thumbnail/{{photo.id}}.jpg"
{% else %}
{% set choice =
thumbnails.get(photo.extension,
thumbnails.get(photo.mimetype,
'other'))
%}
src="/static/basic_thumbnails/{{choice}}.png"
{% endif %}
>
</a>
</div>
<div class="photo_card_grid_info">
<a target="_blank" class="photo_card_grid_filename" href="/photo/{{photo.id}}">{{photo.basename}}</a>
<div class="photo_card_grid_file_metadata">
<div class="photo_card_grid_tags">
{% set tags = photo.tags() %}
{% set tag_names = [] %}
{% for tag in tags %}
{% do tag_names.append(tag.name) %}
{% endfor %}
{% if tags %}
<span title="{{", ".join(tag_names)}}">T</span>
{% endif %}
</div>
<span>
{% if photo.width %}
{{photo.width}}x{{photo.height}},
{% endif %}
{% if photo.duration %}
{{photo.duration_string()}},
{% endif %}
<a target="_blank" href="/file/{{photo.id}}.{{photo.extension}}">{{photo.bytestring()}}</a>
</span>
</div>
</div>
</div>
{% endif %}
{% endmacro %}