aboutsummaryrefslogtreecommitdiff
path: root/module/html/view/search.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-10 17:36:03 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-10 17:36:03 +0200
commitee9989c82c43428e6b91b08f1e31497b154e8d17 (patch)
tree6f4fa564311fd1a633e6a10ec48a2eca5c352a46 /module/html/view/search.scm
parentFix problems with new HTML for calendar view. (diff)
downloadcalp-ee9989c82c43428e6b91b08f1e31497b154e8d17.tar.gz
calp-ee9989c82c43428e6b91b08f1e31497b154e8d17.tar.xz
Rename html search module.
Diffstat (limited to 'module/html/view/search.scm')
-rw-r--r--module/html/view/search.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/module/html/view/search.scm b/module/html/view/search.scm
new file mode 100644
index 00000000..2b93ebfc
--- /dev/null
+++ b/module/html/view/search.scm
@@ -0,0 +1,37 @@
+(define-module (html view search)
+ :use-module (util)
+ :use-module (vcomponent)
+ :use-module (vcomponent search)
+ :use-module ((ice-9 pretty-print) :select (pretty-print))
+ :use-module ((html components)
+ :select (xhtml-doc include-css))
+ :use-module ((html vcomponent)
+ :select (compact-event-list))
+ )
+
+(define-public (search-result-page
+ 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%"))
+ ,(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)) "»"))))
+ )))
+