diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-02-01 13:19:39 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-02-01 13:19:39 +0100 |
commit | 41ed7571b4ee823e226de7f40dd49f46a5f8dff5 (patch) | |
tree | a43cb95d4de9681ad19dc960788424414a2f136a /module | |
parent | Merge branch 'edit-rrule' (diff) | |
download | calp-41ed7571b4ee823e226de7f40dd49f46a5f8dff5.tar.gz calp-41ed7571b4ee823e226de7f40dd49f46a5f8dff5.tar.xz |
Add only-future checkbox on search page.
Diffstat (limited to '')
-rw-r--r-- | module/calp/html/view/search.scm | 2 | ||||
-rw-r--r-- | module/calp/server/routes.scm | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/module/calp/html/view/search.scm b/module/calp/html/view/search.scm index 00f00bb0..fd5000df 100644 --- a/module/calp/html/view/search.scm +++ b/module/calp/html/view/search.scm @@ -24,6 +24,8 @@ ,(when has-query? (with-output-to-string (lambda () (pretty-print search-term)))))) + (label (@ (for "onlyfuture")) "limit to future occurences") + (input (@ (name "onlyfuture") (id "onlyfuture") (type checkbox))) (input (@ (type submit)))) ,@(if errors `((h2 "Error searching") diff --git a/module/calp/server/routes.scm b/module/calp/server/routes.scm index 368c7cb0..db4e819b 100644 --- a/module/calp/server/routes.scm +++ b/module/calp/server/routes.scm @@ -361,8 +361,12 @@ (prop event 'SUMMARY))))) )))))) - (GET "/search" (q p) - (define search-term (and=> q prepare-string)) + (GET "/search" (q p onlyfuture) + (define search-term + (if onlyfuture + `(and (date/-time<=? ,(current-datetime) (prop event 'DTSTART)) + ,(and=> q prepare-string)) + (and=> q prepare-string))) ;; keep original string for links below. Should guarantee that it's correct. (define q= (if (not q) |