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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user