diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-23 23:22:10 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-23 23:22:10 +0200 |
commit | edaf758b80fed1f5f14cd4b192e661c8863e84bc (patch) | |
tree | 9baf17c11a6254e81f29a1c473e5eb86c072aa79 /module/calp/html/view/search.scm | |
parent | Add rendering of standalone small-cal. (diff) | |
download | calp-edaf758b80fed1f5f14cd4b192e661c8863e84bc.tar.gz calp-edaf758b80fed1f5f14cd4b192e661c8863e84bc.tar.xz |
Move html modules under calp.
Diffstat (limited to 'module/calp/html/view/search.scm')
-rw-r--r-- | module/calp/html/view/search.scm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/module/calp/html/view/search.scm b/module/calp/html/view/search.scm new file mode 100644 index 00000000..faefe6dc --- /dev/null +++ b/module/calp/html/view/search.scm @@ -0,0 +1,38 @@ +(define-module (calp html view search) + :use-module (util) + :use-module (vcomponent) + :use-module (vcomponent search) + :use-module ((ice-9 pretty-print) :select (pretty-print)) + :use-module ((calp html components) + :select (xhtml-doc include-css)) + :use-module ((calp html vcomponent) + :select (compact-event-list)) + ) + +(define-public (search-result-page + has-query? search-term search-result page paginator q=) + (xhtml-doc + (@ (lang sv)) + (head (title "Search results") + ,(include-css "/static/style.css")) + (body + (h2 "Search term") + (form + (pre (textarea (@ (name "q") (rows 5) (spellcheck false) + (style "width:100%")) + ,(when has-query? + (with-output-to-string + (lambda () (pretty-print search-term)))))) + (input (@ (type submit)))) + (h2 "Result (page " ,page ")") + (ul + ,@(compact-event-list search-result)) + (div (@ (class "paginator")) + ,@(paginator->list + paginator + (lambda (p) (if (= p page) + `(span ,p) + `(a (@ (href "?" ,q= "&p=" ,p)) ,p))) + (lambda (p) `(a (@ (href "?" ,q= "&p=" ,p)) "»")))) + ))) + |