mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-12 05:05:32 +02:00
Display selected tags in tag cloud (#307)
* Add links to remove tags from current query * Display selected tags in tag cloud * Add tag cloud tests * Fix tag cloud in archive * Add tests for bookmark views * Expose parse query string * Improve tag cloud tests * Cleanup * Fix rebase issues * Ignore casing when removing tags from query Co-authored-by: Jon Hauris <jonp@hauris.org>
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<div class="content-area-header">
|
||||
<h2>Tags</h2>
|
||||
</div>
|
||||
{% tag_cloud tags %}
|
||||
{% tag_cloud tags selected_tags %}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
{% if bookmark.tag_names %}
|
||||
<span>
|
||||
{% for tag_name in bookmark.tag_names %}
|
||||
<a href="?{% append_query_param q=tag_name|hash_tag %}">{{ tag_name|hash_tag }}</a>
|
||||
<a href="?{% append_to_query_param q=tag_name|hash_tag %}">{{ tag_name|hash_tag }}</a>
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
@@ -36,7 +36,7 @@
|
||||
<div class="content-area-header">
|
||||
<h2>Tags</h2>
|
||||
</div>
|
||||
{% tag_cloud tags %}
|
||||
{% tag_cloud tags selected_tags %}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
@@ -39,7 +39,7 @@
|
||||
<div class="content-area-header">
|
||||
<h2>Tags</h2>
|
||||
</div>
|
||||
{% tag_cloud tags %}
|
||||
{% tag_cloud tags selected_tags %}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
@@ -1,23 +1,35 @@
|
||||
{% load shared %}
|
||||
|
||||
<div class="tag-cloud">
|
||||
{% for group in groups %}
|
||||
<p class="group">
|
||||
{% for tag in group.tags %}
|
||||
{# 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" data-is-tag-item>
|
||||
<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" data-is-tag-item>
|
||||
<span>{{ tag.name }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if has_selected_tags %}
|
||||
<p class="selected-tags">
|
||||
{% for tag in selected_tags %}
|
||||
<a href="?{% remove_from_query_param q=tag.name|hash_tag %}"
|
||||
class="text-bold mr-2">
|
||||
<span>-{{ tag.name }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<div class="unselected-tags">
|
||||
{% for group in groups %}
|
||||
<p class="group">
|
||||
{% for tag in group.tags %}
|
||||
{# Highlight first char of first tag in group #}
|
||||
{% if forloop.counter == 1 %}
|
||||
<a href="?{% append_to_query_param q=tag.name|hash_tag %}"
|
||||
class="mr-2" data-is-tag-item>
|
||||
<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_to_query_param q=tag.name|hash_tag %}"
|
||||
class="mr-2" data-is-tag-item>
|
||||
<span>{{ tag.name }}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user