From 5a91457a5b8595969957cd6676afc2fff858251e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Aug 2020 17:19:37 +0200 Subject: HTML Created events now have a description. Unfortunately they ALWAYS have a description. --- module/html/vcomponent.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/html/vcomponent.scm') diff --git a/module/html/vcomponent.scm b/module/html/vcomponent.scm index f9c24ecd..ca8a81c2 100644 --- a/module/html/vcomponent.scm +++ b/module/html/vcomponent.scm @@ -78,8 +78,9 @@ (div (@ (class "location")) ,(string-map (lambda (c) (if (char=? c #\,) #\newline c)) (prop ev 'LOCATION))))) - ,(and=> (prop ev 'DESCRIPTION) - (lambda (str) (format-description ev str))) + ,(awhen (prop ev 'DESCRIPTION) + `(span (@ (class "description")) + ,(format-description ev it))) ,(awhen (prop ev 'RRULE) `(span (@ (class "rrule")) ,@(format-recurrence-rule ev))) -- cgit v1.2.3 From 2e684fd427097965834bd5f1f22196be99b82757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Aug 2020 19:49:28 +0200 Subject: Allow events to enter edit mode after creation. --- module/html/vcomponent.scm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'module/html/vcomponent.scm') diff --git a/module/html/vcomponent.scm b/module/html/vcomponent.scm index ca8a81c2..308f779a 100644 --- a/module/html/vcomponent.scm +++ b/module/html/vcomponent.scm @@ -175,6 +175,9 @@ title: "Stäng" onclick: "close_popup(document.getElementById(this.closest('.popup-container').id))" class: '("close-tooltip")) + ,(btn "🖊️" + title: "Redigera" + onclick: "place_in_edit_mode(document.getElementById(this.closest('.popup-container').id.substr(5)))") ,(btn "🗑" title: "Ta bort" onclick: "remove_event(document.getElementById(this.closest('.popup-container').id.substr(5)))")) -- cgit v1.2.3 From 70dd50111a339fd9fcf54cc2f9670c1313a154a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Aug 2020 20:25:56 +0200 Subject: Mercge CAL and CAL_bg css classes. --- module/html/vcomponent.scm | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'module/html/vcomponent.scm') diff --git a/module/html/vcomponent.scm b/module/html/vcomponent.scm index 308f779a..1b17f039 100644 --- a/module/html/vcomponent.scm +++ b/module/html/vcomponent.scm @@ -50,7 +50,7 @@ ;; (format (current-error-port) "fmt-single-event: ~a~%" (prop ev 'X-HNH-FILENAME)) `(article (@ ,@(assq-merge attributes - `((class "eventtext CAL_bg_" + `((class "eventtext CAL_" ,(html-attr (or (prop (parent ev) 'NAME) "unknown")) ,(when (and (prop ev 'PARTSTAT) (eq? 'TENTATIVE (prop ev 'PARTSTAT))) @@ -119,16 +119,14 @@ (define-public (calendar-styles calendars) `(style - ,(format - #f "~:{.CAL_~a { background-color: ~a; color: ~a }~%.CAL_bg_~a { border-color: ~a }~%~}" - (map (lambda (c) - (let* ((name (html-attr (prop c 'NAME))) - (bg-color (prop c 'COLOR)) - (fg-color (and=> (prop c 'COLOR) - calculate-fg-color))) - (list name (or bg-color 'white) (or fg-color 'black) - name (or bg-color 'black)))) - calendars)))) + ,(format #f "~:{.CAL_~a { --color: ~a; --complement: ~a }~%~}" + (map (lambda (c) + (let* ((name (html-attr (prop c 'NAME))) + (bg-color (prop c 'COLOR)) + (fg-color (and=> (prop c 'COLOR) + calculate-fg-color))) + (list name (or bg-color 'white) (or fg-color 'black)))) + calendars)))) ;; "Physical" block in calendar view (define*-public (make-block ev optional: (extra-attributes '())) -- cgit v1.2.3 From 263e64dfe8549e6c726fb06dd5cdc03fa6a90298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Aug 2020 20:41:28 +0200 Subject: Limit CAL_ class to once per 'thing'. --- module/html/vcomponent.scm | 52 +++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'module/html/vcomponent.scm') 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")))))))))) -- cgit v1.2.3 From e360d3566eb878a944dada510a0c7e8437a5554b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Aug 2020 21:31:52 +0200 Subject: Fix frontend for calendar choosing. --- module/html/vcomponent.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'module/html/vcomponent.scm') diff --git a/module/html/vcomponent.scm b/module/html/vcomponent.scm index 5123af09..3fac17bb 100644 --- a/module/html/vcomponent.scm +++ b/module/html/vcomponent.scm @@ -168,10 +168,13 @@ (define-public (popup ev id) - `(div (@ (class "popup-container") (id ,id) + `(div (@ (id ,id) (class "popup-container CAL_" + ,(html-attr (or (prop (parent ev) 'NAME) + "unknown"))) (onclick "event.stopPropagation()")) - (div (@ (class "popup CAL_" ,(html-attr (or (prop (parent ev) 'NAME) - "unknown"))) ) + ;; TODO all (?) code uses .popup-container as the popup, while .popup sits and does nothing. + ;; Do something about this? + (div (@ (class "popup")) (nav (@ (class "popup-control")) ,(btn "×" title: "Stäng" -- cgit v1.2.3 From 002787fd54d7e7b5dc2965e164691f85cccc3953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 12 Aug 2020 14:04:31 +0200 Subject: Can create events in different calentdars, given that the calendars have simple names. --- module/html/vcomponent.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'module/html/vcomponent.scm') diff --git a/module/html/vcomponent.scm b/module/html/vcomponent.scm index fdaea217..5e7b4ba8 100644 --- a/module/html/vcomponent.scm +++ b/module/html/vcomponent.scm @@ -142,6 +142,7 @@ (div (@ ,@(assq-merge extra-attributes `((id ,(html-id ev)) + (data-calendar ,(html-attr (or (prop (parent ev) 'NAME) "unknown"))) (class "event CAL_" ,(html-attr (or (prop (parent ev) 'NAME) "unknown")) ,(when (and (prop ev 'PARTSTAT) -- cgit v1.2.3