etiquette/templates/photo_card.html

65 lines
2 KiB
HTML
Raw Normal View History

2016-11-06 04:24:43 +00:00
{% set thumbnails =
2016-10-10 03:50:13 +00:00
{
"audio": "audio",
"archive": "archive",
2016-10-10 03:50:13 +00:00
"txt": "txt",
2016-10-30 21:20:46 +00:00
"svg": "svg",
2016-10-10 03:50:13 +00:00
"video": "video",
}
%}
2016-11-07 02:00:30 +00:00
{% 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>
2016-11-07 02:00:30 +00:00
</div>
{% else %}
<div class="photo_card_grid">
<div class="photo_card_grid_thumb">
<a target="_blank" href="/photo/{{photo.id}}">
2016-09-18 08:33:46 +00:00
<img height="150"
{% if photo.thumbnail %}
src="/thumbnail/{{photo.id}}.jpg"
2016-12-14 21:26:42 +00:00
{% else %}
{% set choice =
thumbnails.get(photo.extension,
thumbnails.get(photo.mimetype,
2016-12-14 21:26:42 +00:00
'other'))
%}
src="/static/basic_thumbnails/{{choice}}.png"
{% endif %}
>
2016-09-18 08:33:46 +00:00
</a>
</div>
2016-11-07 02:00:30 +00:00
<div class="photo_card_grid_info">
<div class="photo_card_grid_filename">
<a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a>
</div>
<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}}&times;{{photo.height}},
2016-10-10 03:50:13 +00:00
{% endif %}
{% if photo.duration %}
{{photo.duration_string()}},
{% endif %}
<a target="_blank" href="/file/{{photo.id}}.{{photo.extension}}">{{photo.bytestring()}}</a>
</span>
</div>
2016-09-18 08:33:46 +00:00
</div>
</div>
2016-11-07 02:00:30 +00:00
{% endif %}
2016-12-14 21:26:42 +00:00
{% endmacro %}