Extensions list: sort_by parameter #159

Merged
Márton Lente merged 36 commits from filter-sort into main 2024-06-03 12:57:45 +02:00
2 changed files with 28 additions and 25 deletions
Showing only changes of commit 3b4dbfc5ef - Show all commits

View File

@ -10,6 +10,10 @@
display: flex
+padding(2)
.badge
+margin(3, left)
pointer-events: none
.dropdown-item,
.dropdown-toggle
white-space: nowrap
@ -30,7 +34,6 @@
.dropdown-menu-filter-sort
max-height: calc(var(--spacer) * 24.25)
overflow: auto
.dropdown-item
line-height: var(--lh-base)

View File

@ -21,20 +21,15 @@
</h2>
{% endif %}
<div class="d-flex">
<div class="btn-row align-items-center">
<span class="text-secondary">Filter</span>
{% if tags %}
<div class="dropdown dropdown-filter-sort me-2">
<button class="align-items-center d-flex dropdown-toggle js-dropdown-toggle" data-toggle-menu-id="js-dropdown-menu-filter">
<div class="dropdown dropdown-filter-sort">
<button class="dropdown-toggle js-dropdown-toggle" data-toggle-menu-id="js-dropdown-menu-filter">
{% if tag %}
{{ tag.name }}
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
{{ current_tag_count }}
</div>
{% else %}
All
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
{{ total_count }}
</div>
{% endif %}
<i class="i-chevron-down"></i>
@ -45,7 +40,7 @@
{# TODO @back-end: Find a proper way to get the plural tag type to build the URL. #}
<a class="dropdown-item {% if not tag.name %}is-active{% endif %}" href="/{{ tag.get_type_display|slugify }}s/">
All
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
<div class="badge">
{{ total_count }}
</div>
</a>
@ -55,7 +50,7 @@
<li>
<a class="dropdown-item {% if tag.name == list_tag.name %}is-active{% endif %}" href="{% url "extensions:by-tag" tag_slug=list_tag.slug %}" title="{{ list_tag.name }}">
{{ list_tag.name }}
<div class="align-items-center bg-tertiary d-flex h-4 fs-xs justify-content-center ms-2 rounded-circle w-4">
<div class="badge">
{{list_tag.count}}
</div>
</a>
@ -64,9 +59,12 @@
</ul>
</div>
{% endif %}
<div class="dropdown dropdown-filter-sort">
<div class="d-flex align-items-center ms-3">
<span class="text-secondary">Sort By</span>
<div class="dropdown dropdown-filter-sort ms-3">
<button class="dropdown-toggle js-dropdown-toggle" data-toggle-menu-id="js-dropdown-menu-sort">
Sort by {{ sort_by_option_name }} <i class="i-chevron-down"></i>
{{ sort_by_option_name }} <i class="i-chevron-down"></i>
</button>
<ul class="dropdown-menu dropdown-menu-filter-sort dropdown-menu-right js-dropdown-menu" id="js-dropdown-menu-sort">
{% for option_sort_by, name in sort_by_options.items %}
@ -79,6 +77,8 @@
</ul>
</div>
</div>
</div>
</div>
</div>
{% else %}