summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-04-06 19:08:32 -0700
committercolin <colin@cicadas.surf>2023-04-06 19:08:32 -0700
commitc485cbebcb4ea818c03840d7f562d30f5a8f463f (patch)
tree4c1145773b8b7c8898e21ef791f4f653ae7a1503
parentc73ba43c16d8ad4f50187b647571f7ed3ebb9943 (diff)
Pagination to big theme packages
-rw-r--r--fussy.lisp13
1 files changed, 7 insertions, 6 deletions
diff --git a/fussy.lisp b/fussy.lisp
index 0c44405..68ac9ea 100644
--- a/fussy.lisp
+++ b/fussy.lisp
@@ -357,10 +357,7 @@ that they are not loaded during image gen.")
(:span " "
(:a :href (format nil "?page=~a" pg)
(format nil "~a" (1+ pg)))
- " ")))
-
-
- )))
+ " "))))))
(defun theme-preview-image (theme &optional variant)
(html:with-html
@@ -531,7 +528,7 @@ h1 {
(defun package-namestring (pkg)
(hq:>> () pkg theme-pkg-name symbol-name string-downcase))
-(lzb:defendpoint* :get "/package/:pkg a-package:" () ()
+(lzb:defendpoint* :get "/package/:pkg a-package:" ((page an-integer)) ()
"The page endpoint for a theme package"
(let ((themes
(themes-in-package pkg)))
@@ -552,8 +549,12 @@ h1 {
(if (= 1 (length themes)) " theme" " themes"))
(:p (:a :href (theme-pkg-url pkg)
(theme-pkg-url pkg))))
+ (when (< +themes-per-page+ (length themes))
+ (page-nav (or page 0) (1- (length themes))))
(:div :class "container"
- (dolist (theme themes)
+ (dolist (theme (a:subseq* themes
+ (* page +themes-per-page+)
+ (* (1+ page) +themes-per-page+)))
(theme-preview-card theme)))))))))
(lzb:defendpoint* :get "/theme/:pkg a-package:/:theme a-theme:" () ()