From 85528396ad614bad64423dbe013735c0490b814c Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 27 Mar 2026 15:52:08 -0400 Subject: [PATCH] feat(templates): add wrapper div and pagination to BookShelf Add books-grid wrapper div and pagination controls to BookShelf template to fix HTMX targeting issue. Changes: - Add id="books-grid" wrapper div around BooksGrid component - Add pagination section with Previous/Next buttons - Pagination uses HTMX to target #books-grid for updates - Include #filter-form in HTMX requests to preserve filters Fixes pagination displaying inside the grid instead of below it. The wrapper div ensures HTMX replaces only the grid content, not the pagination controls. Related: Issue #2 - Fix pagination display location --- templates/bookshelf.templ | 45 +++++++++++++++++++++++++++------ templates/bookshelf_templ.go | 49 +++++++++++++++++++++++++++++++++--- 2 files changed, 84 insertions(+), 10 deletions(-) diff --git a/templates/bookshelf.templ b/templates/bookshelf.templ index 9d004cc..46b5d35 100644 --- a/templates/bookshelf.templ +++ b/templates/bookshelf.templ @@ -320,13 +320,44 @@ templ BookShelf( - @BooksGrid(books, limit, offset, count, currentLibraryID) - - if errorMessage != "" { -
-

{ errorMessage }

-
- } +
+ @BooksGrid(books, limit, offset, count, currentLibraryID) + + if errorMessage != "" { +
+

{ errorMessage }

+
+ } +
+ +
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -194,7 +194,7 @@ func BookShelf( var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(errorMessage) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/bookshelf.templ`, Line: 327, Col: 58} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/bookshelf.templ`, Line: 328, Col: 59} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -205,7 +205,50 @@ func BookShelf( return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "

Save Filter

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if count > 0 { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, " Page ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(offset/limit + 1) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/bookshelf.templ`, Line: 347, Col: 32} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, " ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "

Save Filter

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }