Make sidebar category/manufacturer sorting selectable
Kategorien and Hersteller/Quellen lists were hardcoded to sort by count descending. Add a small dropdown (Name A-Z / Anzahl) above the lists on both the Links and Prompts pages, backed by a new facet_sort query param plumbed through facets()/prompt_facets(). Defaults to alphabetical, which was the actual ask; count sort stays available for anyone who preferred the old behavior. All sidebar facet links carry the current facet_sort so it doesn't reset when filtering. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,14 +7,23 @@
|
||||
<div class="layout">
|
||||
<aside class="sidebar">
|
||||
<div class="panel">
|
||||
<a href="/?sort={{ sort }}" class="facet {% if not active_category and not active_manufacturer and not review_only %}active{% endif %}">
|
||||
<a href="/?sort={{ sort }}&facet_sort={{ facet_sort }}" class="facet {% if not active_category and not active_manufacturer and not review_only %}active{% endif %}">
|
||||
<span>{{ icons.grid(size=14) }} Alle Links</span>
|
||||
</a>
|
||||
|
||||
<div style="display:flex; justify-content:flex-end; margin-top:12px;">
|
||||
<select onchange="const u=new URL(location); u.searchParams.set('facet_sort', this.value); location.href=u;"
|
||||
title="Sortierung der Kategorie-/Hersteller-Listen" style="font-size:.75rem; padding:3px 6px;">
|
||||
{% for value, label in facet_sort_options.items() %}
|
||||
<option value="{{ value }}" {% if facet_sort == value %}selected{% endif %}>{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="facet-group">
|
||||
<h3>Kategorien</h3>
|
||||
{% for name, count in facets.categories %}
|
||||
<a href="/?category={{ name | urlencode }}&sort={{ sort }}"
|
||||
<a href="/?category={{ name | urlencode }}&sort={{ sort }}&facet_sort={{ facet_sort }}"
|
||||
class="facet {% if active_category == name and not review_only %}active{% endif %}">
|
||||
<span>{{ name }}</span><span class="count">{{ count }}</span>
|
||||
</a>
|
||||
@@ -26,7 +35,7 @@
|
||||
<div class="facet-group">
|
||||
<h3>Hersteller / Quellen</h3>
|
||||
{% for name, count in facets.manufacturers %}
|
||||
<a href="/?manufacturer={{ name | urlencode }}&sort={{ sort }}"
|
||||
<a href="/?manufacturer={{ name | urlencode }}&sort={{ sort }}&facet_sort={{ facet_sort }}"
|
||||
class="facet {% if active_manufacturer == name and not review_only %}active{% endif %}">
|
||||
<span>{{ name }}</span><span class="count">{{ count }}</span>
|
||||
</a>
|
||||
@@ -37,7 +46,7 @@
|
||||
|
||||
<div class="facet-group">
|
||||
<h3>Merkliste</h3>
|
||||
<a href="/?review=1&sort={{ sort }}" class="facet {% if review_only %}active{% endif %}">
|
||||
<a href="/?review=1&sort={{ sort }}&facet_sort={{ facet_sort }}" class="facet {% if review_only %}active{% endif %}">
|
||||
<span>{{ icons.bookmark(size=14) }} Zur Durchsicht</span><span class="count">{{ facets.review_count }}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user