From bac2f4151cced34828c6f9e821fd624207c44559 Mon Sep 17 00:00:00 2001 From: perennial Date: Wed, 2 Oct 2024 18:45:59 +1000 Subject: [PATCH] use switcher for user page --- assets/views/blocks/switcher.jet.html | 4 ++-- assets/views/user.jet.html | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/assets/views/blocks/switcher.jet.html b/assets/views/blocks/switcher.jet.html index dd3edcf..13a892a 100644 --- a/assets/views/blocks/switcher.jet.html +++ b/assets/views/blocks/switcher.jet.html @@ -2,8 +2,8 @@ This Jet template block renders a switcher using Bootstrap buttons. It takes four parameters: - baseURL: The base URL for all buttons - - paths: An array of URL paths for each button - - names: An array of display names/labels for each button + - paths: A slice of URL paths for each button + - names: A slice of display names/labels for each button - activeState: The current active path to highlight the corresponding button The template loops through the paths, creating a button for each one. diff --git a/assets/views/user.jet.html b/assets/views/user.jet.html index 6efcbae..57fe3f8 100644 --- a/assets/views/user.jet.html +++ b/assets/views/user.jet.html @@ -1,19 +1,18 @@ {{- extends "layout/default" }} {{- import "blocks/pagination" }} +{{- import "blocks/switcher" }} {{- block body() }}
{{- if ! .User.BackgroundImage }} -
+
{{- else }} -
+
{{ .User.Name }}
{{- end }}
-
-
@@ -54,13 +53,12 @@

Category

- +
+ {{- baseURL := "/users/" + .User.ID + "/" }} + {{- paths := slice("", "illustrations", "manga", "novels", "bookmarks") }} + {{- names := slice("All", "Illustrations", "Mangas", "Novels", "Bookmarks") }} + {{- yield Switcher(baseURL=baseURL, paths=paths, names=names, activeState=.Category) }} +
@@ -82,7 +80,7 @@
{{- end }}
-s + {{- url := "/users/" + .User.ID + "/" + .Category + "?page="}} {{- paginationData := createPaginator(url, "#checkpoint", .Page, -1, 1, 5) }} {{- yield pagination(data=paginationData) }}