Filter tag cloud based on search query

This commit is contained in:
Sascha Ißbrücker
2019-06-30 21:15:02 +02:00
parent ff68d2591f
commit e157bcd34f
5 changed files with 74 additions and 19 deletions

View File

@@ -3,11 +3,20 @@
<div class="tag-cloud">
{% for group in groups %}
<p class="group">
<span class="group-label mr-2">{{ group.char }}</span>
{% for tag in group.tags %}
<a href="?{% append_query_param q=tag.name|hash_tag %}">
<span class="mr-2">{{ tag.name }}</span>
</a>
{# Highlight first char of first tag in group #}
{% if forloop.counter == 1 %}
<a href="?{% append_query_param q=tag.name|hash_tag %}"
class="mr-2">
<span class="highlight-char">{{ tag.name|first_char }}</span><span>{{ tag.name|remaining_chars:1 }}</span>
</a>
{% else %}
{# Render remaining tags normally #}
<a href="?{% append_query_param q=tag.name|hash_tag %}"
class="mr-2">
<span>{{ tag.name }}</span>
</a>
{% endif %}
{% endfor %}
</p>
{% endfor %}