aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--module/calp/html/view/search.scm2
-rw-r--r--module/calp/server/routes.scm8
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)