aboutsummaryrefslogtreecommitdiff
path: root/module/html/vcomponent.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-14 01:48:39 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-14 01:48:39 +0200
commitf2068d28f24164d850983a26ad98f46078be1217 (patch)
treea8b8d92f5a65acfb4bb7988707a2f32329b252a1 /module/html/vcomponent.scm
parentAdd popup dropshadows. (diff)
downloadcalp-f2068d28f24164d850983a26ad98f46078be1217.tar.gz
calp-f2068d28f24164d850983a26ad98f46078be1217.tar.xz
Popup style improvement, add tab for repeats.
Diffstat (limited to 'module/html/vcomponent.scm')
-rw-r--r--module/html/vcomponent.scm92
1 files changed, 50 insertions, 42 deletions
diff --git a/module/html/vcomponent.scm b/module/html/vcomponent.scm
index 5e7b4ba8..9efaf77d 100644
--- a/module/html/vcomponent.scm
+++ b/module/html/vcomponent.scm
@@ -53,46 +53,46 @@
optional: (attributes '())
key: (fmt-header list))
;; (format (current-error-port) "fmt-single-event: ~a~%" (prop ev 'X-HNH-FILENAME))
- `(article (@ ,@(assq-merge
- attributes
- `((class " eventtext "
- ,(when (and (prop ev 'PARTSTAT)
- (eq? 'TENTATIVE (prop ev 'PARTSTAT)))
- " tentative ")))))
- (h3 ,(fmt-header
- (when (prop ev 'RRULE)
- `(span (@ (class "repeating")) "↺"))
- `(span (@ (class "summary")) ,(prop ev 'SUMMARY))))
- (div
- ,(call-with-values (lambda () (fmt-time-span ev))
- (case-lambda [(start) `(div (span (@ (class "dtstart")
+ `(div (@ ,@(assq-merge
+ attributes
+ `((class " eventtext "
+ ,(when (and (prop ev 'PARTSTAT)
+ (eq? 'TENTATIVE (prop ev 'PARTSTAT)))
+ " tentative ")))))
+ (h3 ,(fmt-header
+ (when (prop ev 'RRULE)
+ `(span (@ (class "repeating")) "↺"))
+ `(span (@ (class "summary")) ,(prop ev 'SUMMARY))))
+ (div
+ ,(call-with-values (lambda () (fmt-time-span ev))
+ (case-lambda [(start) `(div (span (@ (class "dtstart")
+ (data-fmt "%L%H:%M"))
+ ,start))]
+ [(start end) `(div (span (@ (class "dtstart")
+ ;; TODO same format string
+ ;; as fmt-time-span used
+ (data-fmt "%L%H:%M"))
+ ,start)
+ " — "
+ (span (@ (class "dtend")
(data-fmt "%L%H:%M"))
- ,start))]
- [(start end) `(div (span (@ (class "dtstart")
- ;; TODO same format string
- ;; as fmt-time-span used
- (data-fmt "%L%H:%M"))
- ,start)
- " — "
- (span (@ (class "dtend")
- (data-fmt "%L%H:%M"))
- ,end))]))
- ,(when (and=> (prop ev 'LOCATION) (negate string-null?))
- `(div (b "Plats: ")
- (div (@ (class "location"))
- ,(string-map (lambda (c) (if (char=? c #\,) #\newline c))
- (prop ev 'LOCATION)))))
- ,(awhen (prop ev 'DESCRIPTION)
- `(span (@ (class "description"))
- ,(format-description ev it)))
- ,(awhen (prop ev 'RRULE)
- `(span (@ (class "rrule"))
- ,@(format-recurrence-rule ev)))
- ,(when (prop ev 'LAST-MODIFIED)
- `(span (@ (class "last-modified")) "Senast ändrad "
- ,(datetime->string (prop ev 'LAST-MODIFIED) "~1 ~H:~M")))
-
- )))
+ ,end))]))
+ ,(when (and=> (prop ev 'LOCATION) (negate string-null?))
+ `(div (b "Plats: ")
+ (div (@ (class "location"))
+ ,(string-map (lambda (c) (if (char=? c #\,) #\newline c))
+ (prop ev 'LOCATION)))))
+ ,(awhen (prop ev 'DESCRIPTION)
+ `(span (@ (class "description"))
+ ,(format-description ev it)))
+ ,(awhen (prop ev 'RRULE)
+ `(span (@ (class "rrule"))
+ ,@(format-recurrence-rule ev)))
+ ,(when (prop ev 'LAST-MODIFIED)
+ `(span (@ (class "last-modified")) "Senast ändrad "
+ ,(datetime->string (prop ev 'LAST-MODIFIED) "~1 ~H:~M")))
+
+ )))
;; Single event in side bar (text objects)
@@ -168,6 +168,11 @@
ev)))))))
+(define (repeat-info event)
+ `(div (@ (class "eventtext"))
+ (h2 "Upprepningar")
+ (pre ,(prop event 'RRULE))))
+
(define-public (popup ev id)
`(div (@ (id ,id) (class "popup-container CAL_"
@@ -195,9 +200,12 @@
`(("📅" title: "Översikt"
,(fmt-single-event ev))
("⤓" title: "Nedladdning"
- (div (@ (style "font-family:sans"))
- (p "Ladda ner")
+ (div (@ (class "eventtext") (style "font-family:sans"))
+ (h2 "Ladda ner")
(ul (li (a (@ (href "/calendar/" ,(prop ev 'UID) ".ics"))
"som iCal"))
(li (a (@ (href "/calendar/" ,(prop ev 'UID) ".xcs"))
- "som xCal"))))))))))
+ "som xCal")))))
+ ,@(when (prop ev 'RRULE)
+ `(("↺" title: "Upprepningar" class: "repeating"
+ ,(repeat-info ev)))))))))