Comment cleanup

This commit is contained in:
ThePetrovich 2026-08-21 22:09:17 +08:00
parent c6cbc8fe70
commit f18276ab01
7 changed files with 336 additions and 97 deletions

View file

@ -17,10 +17,14 @@ Optional context:
* empty_message: text shown when ``chips`` is empty (defaults to a generic
placeholder via {{ empty_message|default:_("No options yet.") }}).
Each chip is a real <button>, so it is focusable and answers to Enter/Space; a
<span> was reachable by mouse only.
The accompanying JS (static/src/chip-filters.js) toggles ``.filter-chip.active``
on click and re-emits the comma-separated value into the hidden input keyed by
``data-filter-csv``. Submitting the form sends the result; servers split on
comma. No XHR -- keeps URLs bookmarkable.
``data-filter-csv``, then fires `change` on it so a live table can redraw without
a submit. Submitting the form sends the result; servers split on comma. No XHR by
default -- keeps URLs bookmarkable.
{% endcomment %}
{% load i18n %}
<div class="card mb-3">
@ -29,8 +33,9 @@ comma. No XHR -- keeps URLs bookmarkable.
{% if chips %}
<div class="d-flex flex-wrap gap-1" data-filter-group="{{ name }}">
{% for chip in chips %}
<span class="badge bg-secondary filter-chip {% if chip.selected %}active{% endif %}"
data-value="{{ chip.value }}">{{ chip.label }}</span>
<button type="button" class="filter-chip {% if chip.selected %}active{% endif %}"
aria-pressed="{% if chip.selected %}true{% else %}false{% endif %}"
data-value="{{ chip.value }}">{{ chip.label }}</button>
{% endfor %}
</div>
{% else %}