2017-03-04 06:50:36 +00:00
|
|
|
{# Specific extensions, then specific mimetypes, then general mimtypes #}
|
2016-11-06 04:24:43 +00:00
|
|
|
{% set thumbnails =
|
2016-10-10 03:50:13 +00:00
|
|
|
{
|
2017-03-04 06:50:36 +00:00
|
|
|
"svg": "svg",
|
|
|
|
|
2017-02-28 07:39:06 +00:00
|
|
|
"application/zip": "archive",
|
|
|
|
"application/x-tar": "archive",
|
2017-03-04 06:50:36 +00:00
|
|
|
|
2017-02-28 07:05:43 +00:00
|
|
|
"archive": "archive",
|
2017-03-04 06:50:36 +00:00
|
|
|
"audio": "audio",
|
2016-10-10 03:50:13 +00:00
|
|
|
"video": "video",
|
2017-03-04 06:50:36 +00:00
|
|
|
"text": "txt",
|
|
|
|
|
2016-10-10 03:50:13 +00:00
|
|
|
}
|
|
|
|
%}
|
2016-11-07 02:00:30 +00:00
|
|
|
{% macro create_photo_card(photo, view="grid") %}
|
|
|
|
|
|
|
|
{% if view == "list" %}
|
|
|
|
<div class="photo_card_list">
|
2016-12-21 00:33:40 +00:00
|
|
|
<a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a>
|
2017-02-25 06:07:59 +00:00
|
|
|
<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">
|
2016-12-21 00:33:40 +00:00
|
|
|
<a target="_blank" href="/photo/{{photo.id}}">
|
2016-09-18 08:33:46 +00:00
|
|
|
<img height="150"
|
2016-12-21 00:33:40 +00:00
|
|
|
{% if photo.thumbnail %}
|
|
|
|
src="/thumbnail/{{photo.id}}.jpg"
|
2016-12-14 21:26:42 +00:00
|
|
|
{% else %}
|
|
|
|
{% set choice =
|
2016-12-21 00:33:40 +00:00
|
|
|
thumbnails.get(photo.extension,
|
|
|
|
thumbnails.get(photo.mimetype,
|
2017-02-28 07:39:06 +00:00
|
|
|
thumbnails.get(photo.simple_mimetype,
|
|
|
|
'other')))
|
2016-12-14 21:26:42 +00:00
|
|
|
%}
|
|
|
|
src="/static/basic_thumbnails/{{choice}}.png"
|
|
|
|
{% endif %}
|
2017-02-25 06:07:59 +00:00
|
|
|
>
|
2016-09-18 08:33:46 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
2016-11-07 02:00:30 +00:00
|
|
|
<div class="photo_card_grid_info">
|
2017-02-28 07:05:43 +00:00
|
|
|
<div class="photo_card_grid_filename">
|
2017-05-06 11:13:33 +00:00
|
|
|
<div class="photo_card_grid_filename_hoverhelper">
|
2017-02-28 07:05:43 +00:00
|
|
|
<a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a>
|
2017-05-06 11:13:33 +00:00
|
|
|
</div>
|
2017-02-28 07:05:43 +00:00
|
|
|
</div>
|
2017-02-25 06:07:59 +00:00
|
|
|
<div class="photo_card_grid_file_metadata">
|
2017-03-31 01:54:18 +00:00
|
|
|
{% set tags = photo.tags() %}
|
|
|
|
{% set tag_names = [] %}
|
|
|
|
{% for tag in tags %}
|
|
|
|
{% do tag_names.append(tag.name) %}
|
|
|
|
{% endfor %}
|
|
|
|
{% if tag_names %}
|
|
|
|
<div class="photo_card_grid_tags">
|
|
|
|
{% set tag_names = ", ".join(tag_names) %}
|
|
|
|
<span title="{{tag_names}}">T</span>
|
|
|
|
</div>
|
2017-03-31 02:36:32 +00:00
|
|
|
{% else %}
|
|
|
|
<div></div>
|
2017-03-31 01:54:18 +00:00
|
|
|
{% endif %}
|
2017-02-25 06:07:59 +00:00
|
|
|
<span>
|
|
|
|
{% if photo.width %}
|
2017-02-28 07:05:43 +00:00
|
|
|
{{photo.width}}×{{photo.height}},
|
2016-10-10 03:50:13 +00:00
|
|
|
{% endif %}
|
2017-02-25 06:07:59 +00:00
|
|
|
{% if photo.duration %}
|
2017-03-10 23:07:34 +00:00
|
|
|
{{photo.duration_string}},
|
2017-02-25 06:07:59 +00:00
|
|
|
{% 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 %}
|