Filtering now works

This commit is contained in:
Simon Martens
2025-03-01 01:23:56 +01:00
parent ca33ec7be3
commit 3968f6b1b4
10 changed files with 408 additions and 127 deletions

View File

@@ -146,6 +146,10 @@ class FilterList extends HTMLElement {
this.addEventListener("keydown", this.onEnter.bind(this));
this.addEventListener("focusin", this.onGainFocus.bind(this));
this.addEventListener("focusout", this.onLoseFocus.bind(this));
if (htmx) {
htmx.process(this);
}
}
attributeChangedCallback(name, oldValue, newValue) {
@@ -253,6 +257,10 @@ class FilterList extends HTMLElement {
return item.id;
}
getHREFEncoded(item) {
return encodeURIComponent(this.getHREF(item));
}
getSearchText(item) {
if (!item) {
return "";
@@ -351,7 +359,7 @@ class FilterList extends HTMLElement {
.map(
(item, index) => `
<a
href="${this._url}${this.getHREF(item)}"
href="${this._url}${this.getHREFEncoded(item)}"
class="${FILTER_LIST_ITEM} block px-2.5 py-0.5 hover:bg-slate-200 no-underline ${
index % 2 === 0 ? "bg-stone-100" : "bg-stone-50"
}"