aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-06-19 15:38:01 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-06-19 15:38:01 +0200
commit219506d5f9769f8c36e7f3fea9ac935b4363e005 (patch)
tree218587ef3d05cfb31f5cbab6bc263b84f005dca5 /src
parentc3ff064e97e40388474d4b879ac2ea51b3523381 (diff)
downloadcuirass-219506d5f9769f8c36e7f3fea9ac935b4363e005.tar
cuirass-219506d5f9769f8c36e7f3fea9ac935b4363e005.tar.gz
cuirass: Restore search query.
* src/cuirass/templates.scm (search-form): Take the query as an argument and set it as the value (unless #F). (html-page): Optionally take a value for QUERY as an argument. * src/cuirass/http.scm (url-handler): Let "search" handler pass QUERY to HTML-PAGE.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/http.scm3
-rw-r--r--src/cuirass/templates.scm10
2 files changed, 8 insertions, 5 deletions
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 5bd736b..02fc6f0 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -440,7 +440,8 @@ Hydra format."
(border-high-id . ,border-high-id)))
builds-id-min
builds-id-max)
- '()))
+ '()
+ query))
(respond-json-with-error 500 "Query parameter not provided!"))))
(("static" path ...)
diff --git a/src/cuirass/templates.scm b/src/cuirass/templates.scm
index fb3c7e9..6fa8643 100644
--- a/src/cuirass/templates.scm
+++ b/src/cuirass/templates.scm
@@ -45,7 +45,7 @@
,(assq-ref item #:name)))
(navigation-items rest)))))
-(define search-form
+(define (search-form query)
`(form (@ (id "search")
(class "form-inline")
(action "/search"))
@@ -55,14 +55,16 @@
(class "form-control")
(id "query")
(name "query")
- (placeholder "search for builds")))
+ ,(if query
+ `(value ,query)
+ '(placeholder "search for builds"))))
(span (@ (class "input-group-append"))
(button
(@ (type "submit")
(class "btn btn-primary"))
"Search")))))
-(define (html-page title body navigation)
+(define* (html-page title body navigation #:optional query)
"Return HTML page with given TITLE and BODY."
`(html (@ (xmlns "http://www.w3.org/1999/xhtml")
(xml:lang "en")
@@ -95,7 +97,7 @@
(href "/"))
Home))
,@(navigation-items navigation)))
- ,search-form)
+ ,(search-form query))
(main (@ (role "main") (class "container pt-4 px-1"))
,body
(hr)))))