From 927bd58d3340965328f0ccd05f865175b49a6ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 1 Oct 2021 03:34:06 +0200 Subject: Got date-times working in new system. --- module/calp/html/vcomponent.scm | 121 +++++++++++++++----------------- module/calp/html/view/calendar/week.scm | 49 +++++++------ 2 files changed, 83 insertions(+), 87 deletions(-) (limited to 'module') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 4b3e9ec7..63b3df3b 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -206,11 +206,12 @@ (define-public (edit-template) `(div (@ (class " eventtext edit-tab ")) (form (@ (class "edit-form")) + ;; TODO actually have calendar list here, since we are just a template (div (@ (class "dropdown-goes-here"))) (h3 (input (@ (type "text") (placeholder "Sammanfattning") (name "summary") (required) - (class "bind") (data-property "summary") + (class "interactive") (data-property "summary") ; (value ,(prop ev 'SUMMARY)) ))) @@ -218,36 +219,22 @@ ,@(with-label "Starttid" - `(div (@ (class "date-time") - (name "dtstart")) - (input (@ (type "date") - ; (value ,(date->string (as-date start))) - )) - (input (@ (type "time") - ; (value ,(time->string (as-time start) "~H:~M")) - ; ,@(when (date? start) '((disabled))) - )))) - - ;; TODO some way to add an endtime if missing beforehand - ;; TODO, actually proper support for event without end times + '(date-time-input (@ (name "dtstart") + (class "interactive") + (data-property "dtstart") + ))) + ,@(with-label "Sluttid" - `(div (@ (class "date-time") - (name "dtend")) - (input (@ (type "date") - ; (value ,(date->string (as-date end))) - )) - (input (@ (type "time") - ; (value ,(time->string (as-time end) "~H:~M")) - ; ,@(when (date? end) '((disabled))) - )))) + '(date-time-input (@ (name "dtend") + (class "interactive") + (data-property "dtend")))) (div ,@(with-label "Heldag?" `(input (@ (type "checkbox") (name "wholeday") - ; ,@(when (date? start) '((checked))) )))) ) @@ -257,6 +244,7 @@ `(input (@ (placeholder "Plats") (name "location") (type "text") + (class "interactive") (data-property "location") ; (value ,(or (prop ev 'LOCATION) "")) ))) @@ -264,54 +252,55 @@ ,@(with-label "Beskrivning" `(textarea (@ (placeholder "Beskrivning") + (class "interactive") (data-property "description") (name "description")) ; ,(prop ev 'DESCRIPTION) )) - ,@(with-label - "Kategorier" - ;; It would be better if these input-list's worked on the same - ;; class=bind system as the fields above. The problem with that - ;; is however that each input-list requires different search - ;; and join procedures. Currently this is bound in the JS, see - ;; [CATEGORIES_BIND]. - ;; It matches on ".input-list[data-property='categories']". - `(div (@ (class "input-list") - (data-property "categories")) - #; - ,@(awhen (prop ev 'CATEGORIES) - (map (lambda (c) - `(input (@ (size 2) - (class "unit") - (value ,c)))) - it)) - - (input (@ (class "unit final") - (size 2) - (type "text") - )))) - - (hr) - - ;; For custom user fields - ;; TODO these are currently not bound to anything, so entering data - ;; here does nothing. Bigest hurdle to overcome is supporting arbitrary - ;; fields which will come and go in the JavaScript. - ;; TODO also, all (most? maybe not LAST-MODIFIED) remaining properties - ;; should be exposed here. - (div (@ (class "input-list")) - (div (@ (class "unit final newfield")) - (input (@ (type "text") - (list "known-fields") - (placeholder "Nytt fält"))) - (select (@ (name "TYPE")) - (option (@ (value "TEXT")) "Text")) - (span - (input (@ (type "text") - (placeholder "Värde")))))) - - (hr) + ;; ,@(with-label + ;; "Kategorier" + ;; ;; It would be better if these input-list's worked on the same + ;; ;; class=bind system as the fields above. The problem with that + ;; ;; is however that each input-list requires different search + ;; ;; and join procedures. Currently this is bound in the JS, see + ;; ;; [CATEGORIES_BIND]. + ;; ;; It matches on ".input-list[data-property='categories']". + ;; `(div (@ (class "input-list") + ;; (data-property "categories")) + ;; #; + ;; ,@(awhen (prop ev 'CATEGORIES) + ;; (map (lambda (c) + ;; `(input (@ (size 2) + ;; (class "unit") + ;; (value ,c)))) + ;; it)) + + ;; (input (@ (class "unit final") + ;; (size 2) + ;; (type "text") + ;; )))) + + ;; (hr) + + ;; ;; For custom user fields + ;; ;; TODO these are currently not bound to anything, so entering data + ;; ;; here does nothing. Bigest hurdle to overcome is supporting arbitrary + ;; ;; fields which will come and go in the JavaScript. + ;; ;; TODO also, all (most? maybe not LAST-MODIFIED) remaining properties + ;; ;; should be exposed here. + ;; (div (@ (class "input-list")) + ;; (div (@ (class "unit final newfield")) + ;; (input (@ (type "text") + ;; (list "known-fields") + ;; (placeholder "Nytt fält"))) + ;; (select (@ (name "TYPE")) + ;; (option (@ (value "TEXT")) "Text")) + ;; (span + ;; (input (@ (type "text") + ;; (placeholder "Värde")))))) + + ;; (hr) (input (@ (type "submit"))) diff --git a/module/calp/html/view/calendar/week.scm b/module/calp/html/view/calendar/week.scm index 340db7d5..c2165a8e 100644 --- a/module/calp/html/view/calendar/week.scm +++ b/module/calp/html/view/calendar/week.scm @@ -75,46 +75,53 @@ ;; based on the output of fmt-single-event (define (description-template) '(div (@ (class " eventtext summary-tab " ())) - (h3 ((span (@ (class "repeating")) "↺") + (h3 ((span (@ (class "repeating")) ; "↺" + ) (span (@ (class "bind summary") - (data-property "summary")) - "Test"))) + (data-property "summary"))))) (div (div (time (@ (class "bind dtstart") (data-property "dtstart") (data-fmt "~L~H:~M") - (datetime "2021-09-29T19:56:46")) - "19:56") + (datetime ; "2021-09-29T19:56:46" + )) + ; "19:56" + ) "\xa0—\xa0" (time (@ (class "bind dtend") (data-property "dtend") (data-fmt "~L~H:~M") - (datetime "2021-09-29T19:56:46")) - "20:56")) + (datetime ; "2021-09-29T19:56:46" + )) + ; "20:56" + )) (div (@ (class "fields")) (div (b "Plats: ") (div (@ (class "bind location") (data-property "location")) - "Alsättersgatan 13")) + ; "Alsättersgatan 13" + )) (div (@ (class "bind description") (data-property "description")) - ("With a description")) - (div (@ (class "categories")) - (a (@ (class "category") - (href "/search/?" - "q=%28member%20%22test%22%20%28or%20%28prop%20event%20%28quote%20CATEGORIES%29%29%20%28quote%20%28%29%29%29%29")) - test)) - (div (@ (class "rrule")) - "Upprepas " - "varje vecka" - ".") + ; "With a description" + ) + ;; (div (@ (class "categories")) + ;; (a (@ (class "category") + ;; (href "/search/?" + ;; "q=%28member%20%22test%22%20%28or%20%28prop%20event%20%28quote%20CATEGORIES%29%29%20%28quote%20%28%29%29%29%29")) + ;; test)) + ;; (div (@ (class "rrule")) + ;; "Upprepas " + ;; "varje vecka" + ;; ".") (div (@ (class "last-modified")) - "Senast ändrad " - "2021-09-29 19:56"))))) + "Senast ändrad -" + ; "2021-09-29 19:56" + ))))) (define (block-template) `(div (@ ; (id ,(html-id ev)) (data-calendar "unknown") - (class "event CAL_unknown" + (class "event CAL_unknown" ;; ,(when (and (prop ev 'PARTSTAT) ;; (eq? 'TENTATIVE (prop ev 'PARTSTAT))) ;; " tentative") -- cgit v1.2.3