From a1afd3f041bbdfa61820311216ca9418ef5b1fa3 Mon Sep 17 00:00:00 2001 From: eltrac Date: Wed, 13 May 2026 15:12:35 +0800 Subject: refactor(partials): move items/book to components/book We need NoViewTransition attribute to be passed to this partial and Content View (.Render) does not support that. book partial cannot be refactored to view_book, it needs to stay. But since there are no other "items" partials (they're all content views now), items/book is now moved under components. --- layouts/_partials/components/book.html | 24 ++++++++++++++++++++++++ layouts/_partials/items/book.html | 24 ------------------------ layouts/_partials/term/term-books.html | 2 +- layouts/library/page.html | 2 +- layouts/library/section.html | 4 ++-- 5 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 layouts/_partials/components/book.html delete mode 100644 layouts/_partials/items/book.html diff --git a/layouts/_partials/components/book.html b/layouts/_partials/components/book.html new file mode 100644 index 0000000..d9fee4f --- /dev/null +++ b/layouts/_partials/components/book.html @@ -0,0 +1,24 @@ +{{ $ctx := .ctx }} +{{ $NoViewTransition := (or .NoViewTransition false) }} +{{ $cover := printf "%s?width=300" $ctx.Params.cover }} + + + + + {{ if eq $ctx.Params.rating 1 }} +
+ {{ end }} +
+ diff --git a/layouts/_partials/items/book.html b/layouts/_partials/items/book.html deleted file mode 100644 index d9fee4f..0000000 --- a/layouts/_partials/items/book.html +++ /dev/null @@ -1,24 +0,0 @@ -{{ $ctx := .ctx }} -{{ $NoViewTransition := (or .NoViewTransition false) }} -{{ $cover := printf "%s?width=300" $ctx.Params.cover }} - - - - - {{ if eq $ctx.Params.rating 1 }} -
- {{ end }} -
- diff --git a/layouts/_partials/term/term-books.html b/layouts/_partials/term/term-books.html index 2bd4829..3f7e82e 100644 --- a/layouts/_partials/term/term-books.html +++ b/layouts/_partials/term/term-books.html @@ -3,7 +3,7 @@

{{ T "termPage.books" }}

{{ range $books }} - {{ partial "items/book" (dict "ctx" .) }} + {{ partial "components/book" (dict "ctx" .) }} {{ end }}
{{ end }} diff --git a/layouts/library/page.html b/layouts/library/page.html index 00bb94f..eb5f152 100644 --- a/layouts/library/page.html +++ b/layouts/library/page.html @@ -45,7 +45,7 @@ {{ range $term.Pages }} {{ if ne .File.UniqueID $.File.UniqueID }}
- {{ partial "items/book" (dict "ctx" .) }} + {{ partial "components/book" (dict "ctx" .) }}
{{ end }} {{ end }} diff --git a/layouts/library/section.html b/layouts/library/section.html index bb297a0..fa84631 100644 --- a/layouts/library/section.html +++ b/layouts/library/section.html @@ -34,7 +34,7 @@ {{ end }} {{ range $i, $book := $booksToShow }}
- {{ partial "items/book" (dict + {{ partial "components/book" (dict "ctx" $book ) }}
@@ -70,7 +70,7 @@ )}}
{{ range $goodBooks }} - {{ partial "items/book" (dict + {{ partial "components/book" (dict "ctx" . "NoViewTransition" true ) }} -- cgit v1.2.3