repertoire: HTMX OOB swaps for filter columns + fix fading edge cases

Switch from swapping the entire #repertoire-index block to targeted
hx-swap-oob swaps: only the <ul> list elements are replaced, while
section headers and accordion chrome stay in the DOM untouched.

- Filter column <ul>s get IDs (rep-list-years, rep-list-ap, etc.)
  and render with hx-swap-oob=true on HTMX requests
- Students <ul> gets id=rep-students as main swap target
- Filter buttons now target #rep-students instead of #repertoire-index
- Server sets $isOob=true when rendering HTMX partial responses
- Accordion re-init on swap no longer needed (headers never replaced)
- Scroll-restore updated to capture/restore per <ul> ID

Fading fixes:
- Restore rep-entry--faded class with simplified logic: any active
  filter fades entries whose matched flag is false (removed the
  $colHasMatch gate that prevented fading when a column had no matches)
- Add $noResults guard: when matched_ids is empty, force-fade all
  non-selected entries across ALL columns
- Fix keyword matched computation: use full intersection
  ($buildWhere('__none__')) instead of excluding the keyword filter.
  Previously keywords were matched against only non-keyword filters,
  so selecting a keyword would not narrow the available keyword set,
  causing entries to appear valid that would yield zero results.
This commit is contained in:
Pontoporeia
2026-07-10 13:02:32 +02:00
parent ec9c140ba2
commit 83e95bc4f5
+3 -2
View File
@@ -694,8 +694,9 @@ class Database
$allFi = array_column($exec('SELECT name FROM finality_types ORDER BY name', []), 'name'); $allFi = array_column($exec('SELECT name FROM finality_types ORDER BY name', []), 'name');
$fiOut = array_map(fn ($n) => ['value' => $n, 'matched' => in_array($n, $matchedFiIds, true)], $allFi); $fiOut = array_map(fn ($n) => ['value' => $n, 'matched' => in_array($n, $matchedFiIds, true)], $allFi);
// Keywords // Keywords — many-to-many: use full intersection so that selecting
[$w, $b] = $buildWhere('kw'); // a keyword filters the available set to only co-occurring keywords.
[$w, $b] = $buildWhere('__none__');
$matchedKw = array_column($exec( $matchedKw = array_column($exec(
"SELECT DISTINCT tg.name $baseJoins "SELECT DISTINCT tg.name $baseJoins
JOIN thesis_tags tt ON tt.thesis_id = t.id JOIN thesis_tags tt ON tt.thesis_id = t.id