fix(templates): library switcher and bookshelf filter improvements

- bookshelf.templ: Fix form field name from "library" to "library_id"
  to match the handler's QueryParam("library_id"). Add "All Books"
  as the default option in the library filter dropdown. The bookshelf
  uses its own inline filter, NOT the universal library switcher.

- collections.templ: Remove @LibrarySwitcher from the collections list
  page — collections are not library-specific, so the switcher was
  misleading. Fix data-id interpolation bug where {collection.ID} was
  rendered as literal text instead of being interpolated.

- series.templ: Replace inline library selector with the universal
  @LibrarySwitcher component. SeriesCard links no longer include
  library_id since series detail always shows all books.
This commit is contained in:
2026-05-18 17:52:49 -04:00
parent a6f5d8d693
commit d3a510d2e0
6 changed files with 247 additions and 303 deletions
+3 -4
View File
@@ -2,7 +2,7 @@ package templates
import "bookhoard/internal/handlers"
templ Collection(user User, collections []CollectionData, libData []LibraryData, currentLibraryID string, errorMessage string) {
templ Collection(user User, collections []CollectionData, errorMessage string) {
<!DOCTYPE html>
<html lang="en">
<head>
@@ -14,7 +14,6 @@ templ Collection(user User, collections []CollectionData, libData []LibraryData,
</head>
<body x-data="collections" x-init="initCollectionsPage()" class="theme-{ user.Theme }">
@Header(user, "/collections")
@LibrarySwitcher(libData, currentLibraryID)
<!-- Modal Container -->
<div id="modal-container"></div>
<!-- Actual container page -->
@@ -350,8 +349,8 @@ templ CollectionDetail(user User, collection CollectionData, books []handlers.Bo
</body>
<div
id="collection-data"
data-id="{collection.ID}"
data-library-id="{ libraryID }"
data-id={ collection.ID }
data-library-id={ libraryID }
style="display: none;"
></div>
</html>