aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 20:41:28 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 20:41:28 +0200
commit263e64dfe8549e6c726fb06dd5cdc03fa6a90298 (patch)
treed5e1db7248ddd453e71d6776c881f3ce54ac54ed
parentFix color in popups. (diff)
downloadcalp-263e64dfe8549e6c726fb06dd5cdc03fa6a90298.tar.gz
calp-263e64dfe8549e6c726fb06dd5cdc03fa6a90298.tar.xz
Limit CAL_ class to once per 'thing'.
-rw-r--r--module/html/vcomponent.scm52
-rw-r--r--module/html/view/calendar.scm2
-rw-r--r--static/style.css2
3 files changed, 30 insertions, 26 deletions
diff --git a/module/html/vcomponent.scm b/module/html/vcomponent.scm
index 1b17f039..5123af09 100644
--- a/module/html/vcomponent.scm
+++ b/module/html/vcomponent.scm
@@ -43,18 +43,21 @@
;; TODO better format, add show in calendar button
,(fmt-single-event event)))))
-;; For sidebar, just text
+;; Format event as text.
+;; Used in
+;; - sidebar
+;; - popup overwiew tab
+;; - search result (event details)
(define*-public (fmt-single-event ev
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 CAL_"
- ,(html-attr (or (prop (parent ev) 'NAME) "unknown"))
+ `((class " eventtext "
,(when (and (prop ev 'PARTSTAT)
(eq? 'TENTATIVE (prop ev 'PARTSTAT)))
- " tentative")))))
+ " tentative ")))))
(h3 ,(fmt-header
(when (prop ev 'RRULE)
`(span (@ (class "repeating")) "↺"))
@@ -100,13 +103,15 @@
(class "hidelink")) ,s))))
,@(stream->list
(stream-map
- (lambda (ev) (fmt-single-event
- ev `((id ,(html-id ev)))
- fmt-header:
- (lambda body
- `(a (@ (href "#" ,(date-link (as-date (prop ev 'DTSTART))))
- (class "hidelink"))
- ,@body))))
+ (lambda (ev)
+ (fmt-single-event
+ ev `((id ,(html-id ev))
+ (class "CAL_" ,(html-attr (or (prop (parent ev) 'NAME) "unknown"))))
+ fmt-header:
+ (lambda body
+ `(a (@ (href "#" ,(date-link (as-date (prop ev 'DTSTART))))
+ (class "hidelink"))
+ ,@body))))
(stream-filter
(lambda (ev)
;; If start was an earlier day
@@ -165,10 +170,9 @@
(define-public (popup ev id)
`(div (@ (class "popup-container") (id ,id)
(onclick "event.stopPropagation()"))
- (div (@ (class "popup"))
- (nav (@ (class "popup-control CAL_"
- ,(html-attr (or (prop (parent ev) 'NAME)
- "unknown"))))
+ (div (@ (class "popup CAL_" ,(html-attr (or (prop (parent ev) 'NAME)
+ "unknown"))) )
+ (nav (@ (class "popup-control"))
,(btn "×"
title: "Stäng"
onclick: "close_popup(document.getElementById(this.closest('.popup-container').id))"
@@ -181,12 +185,12 @@
onclick: "remove_event(document.getElementById(this.closest('.popup-container').id.substr(5)))"))
,(tabset
- `(("📅" title: "Översikt"
- ,(fmt-single-event ev))
- ("⤓" title: "Nedladdning"
- (div (@ (style "font-family:sans"))
- (p "Ladda ner")
- (ul (li (a (@ (href "/calendar/" ,(prop ev 'UID) ".ics"))
- "som iCal"))
- (li (a (@ (href "/calendar/" ,(prop ev 'UID) ".xcs"))
- "som xCal"))))))))))
+ `(("📅" title: "Översikt"
+ ,(fmt-single-event ev))
+ ("⤓" title: "Nedladdning"
+ (div (@ (style "font-family:sans"))
+ (p "Ladda ner")
+ (ul (li (a (@ (href "/calendar/" ,(prop ev 'UID) ".ics"))
+ "som iCal"))
+ (li (a (@ (href "/calendar/" ,(prop ev 'UID) ".xcs"))
+ "som xCal"))))))))))
diff --git a/module/html/view/calendar.scm b/module/html/view/calendar.scm
index 39f1092d..3c239bc6 100644
--- a/module/html/view/calendar.scm
+++ b/module/html/view/calendar.scm
@@ -291,7 +291,7 @@
(div (@ (id "calendar-dropdown-template") (class "template"))
(select
,@(map (lambda (calendar)
- `(option (@ (value ,(prop calendar 'NAME)))
+ `(option (@ (value ,(html-attr (prop calendar 'NAME))))
,(prop calendar 'NAME)))
calendars))
)))
diff --git a/static/style.css b/static/style.css
index 1a7b2f14..719cca1c 100644
--- a/static/style.css
+++ b/static/style.css
@@ -818,7 +818,7 @@ along with their colors.
}
.tab [type=radio]:checked ~ label ~ .content {
- z-index: 1;
+ z-index: 1;
}
/* Other