aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-12-13 17:13:27 +0000
committerChristopher Baines <mail@cbaines.net>2019-12-13 17:13:27 +0000
commitfc9c44b715ead00564c30341c9b05cf4d00b66a5 (patch)
treefffa550d4f2bb6ff763bf0a38cadbfc3205d1893
parent156b7eea7e7d538e332d8cfcf482c5ebec0a25c0 (diff)
downloaddata-service-fc9c44b715ead00564c30341c9b05cf4d00b66a5.tar
data-service-fc9c44b715ead00564c30341c9b05cf4d00b66a5.tar.gz
Add a utility to help generate next page links
-rw-r--r--guix-data-service/web/html-utils.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/guix-data-service/web/html-utils.scm b/guix-data-service/web/html-utils.scm
index a987984..af8c2d8 100644
--- a/guix-data-service/web/html-utils.scm
+++ b/guix-data-service/web/html-utils.scm
@@ -16,9 +16,13 @@
;;; <http://www.gnu.org/licenses/>.
(define-module (guix-data-service web html-utils)
+ #:use-module (srfi srfi-1)
#:use-module (ice-9 match)
+ #:use-module (guix-data-service web query-parameters)
#:export (sexp-div
+ next-page-link
+
build-status-value->display-string
build-status-span
build-status-alist->build-icon))
@@ -38,6 +42,19 @@
((and string val)
val)))
+(define (next-page-link path
+ query-parameters
+ field
+ value)
+ (string-append
+ path
+ "?"
+ (query-parameters->string
+ `((,field . ,value)
+ ,@(alist-delete
+ field
+ query-parameters)))))
+
(define (build-status-value->display-string value)
(assoc-ref
'(("scheduled" . "Scheduled")