From 88b1aaf304770773c1a252ef8499842d0c0c2925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 4 Aug 2020 13:52:02 +0200 Subject: Fix row count and height. --- module/output/html.scm | 36 ++++++++++++++++++++++++------------ static/style.css | 2 ++ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/module/output/html.scm b/module/output/html.scm index a92299d8..a77b634c 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -458,22 +458,34 @@ (get-groups-between (group-stream (list->stream short-events)) pre-start post-end)) + (define long-event-groups + (map (lambda (s) + (define e (date+ s (date day: 6))) + (cons* s e + (stream->list + (events-between s e (list->stream long-events))))) + (date-range pre-start post-end (date day: 7)))) + `((header (@ (class "table-head")) ,(string-titlecase (date->string start-date "~B ~Y"))) - (div (@ (class "caltable")) + (div (@ (class "caltable") + (style "grid-template-rows: 2em" + ,(string-concatenate + (map (lambda (long-group) + (format #f " [time] 15pt [long] ~amm [short] 1fr" + (min 10 (* 4 (length (cddr long-group)))))) + long-event-groups)))) ,@(map (lambda (d) `(div (@ (class "thead")) ,(string-titlecase (week-day-name d)))) (weekday-list (get-config 'week-start))) - ,@(map (lambda (d i) - (define e (date+ d (date day: 6))) - `(div (@ (class "cal-cell cal-cell-long") - (style "grid-area: long " ,i ";" - "grid-column: 1 / span 7;")) - ,@(lay-out-long-events - d e (stream->list - (events-between d e (list->stream long-events)))))) - (date-range pre-start post-end (date day: 7)) - ;; date range limits, 100 ≫ days in month - (iota 100 1)) + ,@(map (lambda (group i) + (let* (((s e . events) group)) + `(div (@ (class "cal-cell cal-cell-long") + (style "grid-area: long " ,i ";" + "grid-column: 1 / span 7;")) + ,@(lay-out-long-events + s e events)))) + long-event-groups + (iota (length long-event-groups) 1)) ,@(map (lambda (day-date i) `(div (@ (style "grid-area:time " ,(floor i)) (class "cal-cell cal-cell-time")) diff --git a/static/style.css b/static/style.css index f1bdc6fb..2a45bdc6 100644 --- a/static/style.css +++ b/static/style.css @@ -325,7 +325,9 @@ along with their colors. correct way to do it. */ /* grid-template-rows: 2em; */ /* grid-auto-rows: 1fr; */ + /* grid-template-rows: 2em repeat(6, [time] 15pt [long] 1fr [short] 1fr); +*/ max-height: 100%; /* Apparently needed to ensure that parent can contain all its children */ -- cgit v1.2.3