aboutsummaryrefslogtreecommitdiff
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
parentAdd popup dropshadows. (diff)
downloadcalp-f2068d28f24164d850983a26ad98f46078be1217.tar.gz
calp-f2068d28f24164d850983a26ad98f46078be1217.tar.xz
Popup style improvement, add tab for repeats.
-rw-r--r--module/html/components.scm6
-rw-r--r--module/html/vcomponent.scm92
-rw-r--r--module/util.scm5
-rw-r--r--static/style.scss2
4 files changed, 59 insertions, 46 deletions
diff --git a/module/html/components.scm b/module/html/components.scm
index 77156fc5..68c8e763 100644
--- a/module/html/components.scm
+++ b/module/html/components.scm
@@ -101,9 +101,9 @@
`(div (@ (class "tab"))
(input (@ (type "radio") (id ,id) (name ,tabgroup)
,@(when (zero? i) '((checked)))))
- (label (@ (for ,id) (style "top: " ,(* 6 i) "ex")
- ,(awhen (memv title: args)
- `(title ,(cadr it))))
+ (label (@ ,@(assq-merge `((for ,id)
+ (style "top: " ,(* 6 i) "ex"))
+ (kvlist->assq args)))
,key)
(div (@ (class "content")) ,body)))))
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)))))))))
diff --git a/module/util.scm b/module/util.scm
index b646abb5..c1381edd 100644
--- a/module/util.scm
+++ b/module/util.scm
@@ -365,6 +365,11 @@
(assq-set! alist k (append v (or o '())))))
(copy-tree a) b))
+(define-public (kvlist->assq kvlist)
+ (map (lambda (pair)
+ (cons (keyword->symbol (car pair)) (cdr pair)))
+ (group kvlist 2)))
+
(define*-public (assq-limit alist optional: (number 1))
(map (lambda (pair)
(take-to pair (1+ number)))
diff --git a/static/style.scss b/static/style.scss
index a70f5a76..cdca3a55 100644
--- a/static/style.scss
+++ b/static/style.scss
@@ -717,7 +717,7 @@ along with their colors.
max-width: 100%;
}
- article {
+ .eventtext {
/* makes the text in the popup scroll, but not the sidebar */
overflow-y: auto;
padding: 1em;