From 37471b1b5fbfa3379f1d5f3c0323fc3157bf1afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 26 Apr 2020 17:46:05 +0200 Subject: All HTML graphical events now use same render code. --- module/output/html.scm | 102 ++++++++++++++++++++++--------------------------- static/style.css | 16 +++++--- 2 files changed, 56 insertions(+), 62 deletions(-) diff --git a/module/output/html.scm b/module/output/html.scm index d7af8bb2..cf59f22d 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -176,6 +176,32 @@ (inner (+ x w) (left-subtree tree)) (inner x (right-subtree tree)))))) +(define* (make-block ev optional: (extra-attributes '())) + `(a (@ (href "#" ,(UID ev)) + (class "hidelink")) + (div (@ ,@(assq-merge + extra-attributes + `((class "event CAL_" ,(html-attr (or (attr (parent ev) 'NAME) + "unknown")) + ,(when (and (attr ev 'PARTSTAT) (string= "TENTATIVE" (attr ev 'PARTSTAT))) + " tentative")) + ;; TODO only if in debug mode? + ,@(data-attributes ev)))) + + (div (@ (class "event-inner")) + ;; NOTE These popup's are far from good. Main problem being that + ;; the often render off-screen for events high up on the screen. + (div (@ (class "popup")) + ,(event-debug-html ev)) + (div (@ (class "body")) + ,(when (attr ev 'RRULE) + `(span (@ (class "repeating")) "↺")) + ,((get-config 'summary-filter) ev (attr ev 'SUMMARY)) + ,(when (attr ev 'LOCATION) + `(span (@ (class "location")) + ,(string-map (lambda (c) (if (char=? c #\,) #\newline c)) + (attr ev 'LOCATION)))) + )))) ) ;; Format single event for graphical display (define (create-block date ev) @@ -200,39 +226,16 @@ ;; height (* 100/24 (time->decimal-hour (event-length/day date ev))))) - `(a (@ (href "#" ,(UID ev)) - (class "hidelink")) - (div (@ (class "event CAL_" ,(html-attr (or (attr (parent ev) 'NAME) - "unknown")) - ,(when (and (attr ev 'PARTSTAT) (string= "TENTATIVE" (attr ev 'PARTSTAT))) - " tentative") - ,(when (date sxml (define*-public (render-calendar-table key: events start-date end-date pre-start post-end #:allow-other-keys) diff --git a/static/style.css b/static/style.css index 7b17d1ca..bc22f765 100644 --- a/static/style.css +++ b/static/style.css @@ -308,7 +308,7 @@ along with their colors. overflow-y: auto; } -.inline-event { +.cal-cell .event { font-size: 8pt; border-radius: 5px; padding: 2px; @@ -392,7 +392,7 @@ along with their colors. * This makes the borders of the object be part of the size. * Making placing it on the correct line much simpler. */ -.clock, .event { +.clock, .days .event { position: absolute; box-sizing: border-box; margin: 0; @@ -438,12 +438,18 @@ along with their colors. } .event { + transition: 0.3s; + font-size: var(--event-font-size); +} + +.days .event { + border: 1px solid black; +} + +.events .event { width: 100%; - border: 2px solid black; - font-size: var(--event-font-size); - transition: 0.3s; } .events .event.continuing { -- cgit v1.2.3