refactor(templates): _gallery_item.html KIND_EMOJI dict + display_name

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>
This commit is contained in:
2026-04-22 15:59:37 -04:00
parent 934d6ce111
commit 764092e8dd
+15 -18
View File
@@ -10,27 +10,24 @@
{% 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"
href="{{ url_for('main.gallery', tag=t.name) }}"
title="Filter by {{ t.name }}"
<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()">
{% if t.kind == 'artist' %}
🎨 {{ t.name.split(':', 1)[1] if ':' in t.name else t.name }}
{% elif t.kind == 'character' %}
👤 {{ t.name.split(':', 1)[1] if ':' in t.name else t.name }}
{% elif t.kind == 'series' %}
📺 {{ t.name.split(':', 1)[1] if ':' in t.name else t.name }}
{% elif t.kind == 'fandom' %}
🎭 {{ t.name.split(':', 1)[1] if ':' in t.name else t.name }}
{% elif t.kind == 'rating' %}
⚠️ {{ t.name.split(':', 1)[1] if ':' in t.name else t.name }}
{% elif t.kind == 'post' %}
📌 {{ t.name.split(':', 1)[1] if ':' in t.name else t.name }}
{% else %}
#{{ t.name }}
{% endif %}
{{ KIND_EMOJI.get(t.kind, '#') }} {{ t.display_name }}
</a>
{% endfor %}
</div>