764092e8dd
Collapses the six-branch prefix-strip expression into a KIND_EMOJI jinja dict. Anchor hrefs use ?tag_id=. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.5 KiB
HTML
42 lines
1.5 KiB
HTML
<!-- /app/templates/_gallery_item.html -->
|
|
<div class="gallery-item img-clickable"
|
|
data-id="{{ image.id }}"
|
|
data-full="{{ url_for('main.serve_image', filename=image.filepath | replace('/images/', '') ) }}"
|
|
data-type="{{ 'video' if image.filename.lower().endswith(('.mp4', '.mov')) else 'image' }}"
|
|
data-filename="{{ image.filename }}">
|
|
|
|
<div class="gallery-thumb"
|
|
style="background-image: url('{{ url_for('main.serve_image', filename=(image.thumb_path or image.filepath) | replace('/images/', '') ) }}');"></div>
|
|
|
|
{% set visible_tags = image.tags | rejectattr('kind', 'in', ['archive', 'source']) | list %}
|
|
{% if visible_tags %}
|
|
{% set KIND_EMOJI = {
|
|
'artist': '🎨',
|
|
'character': '👤',
|
|
'series': '📺',
|
|
'fandom': '🎭',
|
|
'meta': '⚠️',
|
|
'rating': '⚠️',
|
|
'post': '📌',
|
|
'archive': '📦',
|
|
'user': '#',
|
|
} %}
|
|
<div class="tag-overlay">
|
|
{% for t in visible_tags %}
|
|
<a class="tag-chip tag-chip-{{ t.kind or 'user' }}"
|
|
href="{{ url_for('main.gallery', tag_id=t.id) }}"
|
|
title="Filter by {{ t.display_name }}"
|
|
onclick="event.stopPropagation()">
|
|
{{ KIND_EMOJI.get(t.kind, '#') }} {{ t.display_name }}
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if image.filename.lower().endswith(('.mp4', '.mov')) %}
|
|
<div class="play-overlay"></div>
|
|
{% endif %}
|
|
|
|
<span class="image-date">{{ image.taken_at or image.imported_at | datetimeformat }}</span>
|
|
</div>
|