From bbecd2476ebddb2731065aad2f3895c5074c9ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:11:08 +0200 Subject: Stop using with-label. --- module/calp/html/vcomponent.scm | 80 ++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 45 deletions(-) (limited to 'module') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 9e70f910..85c3829c 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -13,7 +13,6 @@ :use-module ((web uri-query) :select (encode-query-parameters)) :use-module ((calp html util) :select (html-id calculate-fg-color)) :use-module ((calp html config) :select (edit-mode debug)) - :use-module ((calp html components) :select (with-label)) :use-module ((crypto) :select (sha256 checksum->string)) :use-module ((xdg basedir) :prefix xdg-) :use-module ((vcomponent recurrence) :select (repeating?)) @@ -399,64 +398,55 @@ '((selected)))) ,name)) calendars))) - (h3 (input (@ (type "text") - (placeholder ,(_ "Summary")) - (name "summary") (required) - (data-property "summary") + (input (@ (type "text") + (placeholder ,(_ "Summary")) + (name "summary") (required) + (data-property "summary") ; (value ,(prop ev 'SUMMARY)) - ))) + )) (div (@ (class "timeinput")) - ,@(with-label - (_ "Start time") - '(date-time-input (@ (name "dtstart") - (data-property "dtstart") - ))) + (date-time-input (@ (name "dtstart") + (data-property "dtstart") + )) - ,@(with-label - (_ "End time") - '(date-time-input (@ (name "dtend") - (data-property "dtend")))) + (date-time-input (@ (name "dtend") + (data-property "dtend"))) (div (@ (class "checkboxes")) - ,@(with-label - (_ "Whole day?") - `(input (@ (type "checkbox") - (name "wholeday") - ))) - ,@(with-label - (_ "Recurring?") - `(input (@ (type "checkbox") - (name "has_repeats") - )))) + (input (@ (type "checkbox") + (name "wholeday") + (data-label ,(_ "Whole day?")) + )) + (input (@ (type "checkbox") + (name "has_repeats") + (data-label ,(_ "Recurring?")) + ))) ) - ,@(with-label - (_ "Location") - `(input (@ (placeholder ,(_ "Location")) - (name "location") - (type "text") - (data-property "location") + (input (@ (placeholder ,(_ "Location")) + (data-label ,(_ "Location")) + (name "location") + (type "text") + (data-property "location") ; (value ,(or (prop ev 'LOCATION) "")) - ))) + )) - ,@(with-label - (_ "Description") - `(textarea (@ (placeholder ,(_ "Description")) - (data-property "description") - (name "description")) + (textarea (@ (placeholder ,(_ "Description")) + (data-label ,(_ "Description")) + (data-property "description") + (name "description")) ; ,(prop ev 'DESCRIPTION) - )) + ) - ,@(with-label - (_ "Categories") - `(input-list - (@ (name "categories") - (data-property "categories")) - (input (@ (type "text") - (placeholder ,(_ "Category")))))) + (input-list + (@ (name "categories") + (data-property "categories") + (data-label ,(_ "Categories"))) + (input (@ (type "text") + (placeholder ,(_ "Category"))))) ;; TODO This should be a "list" where any field can be edited ;; directly. Major thing holding us back currently is that -- cgit v1.2.3 From 12dc92b8fb1eb2fe81d95d315afde9e84e1174b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:11:52 +0200 Subject: Remove with-label. --- module/calp/html/components.scm | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'module') diff --git a/module/calp/html/components.scm b/module/calp/html/components.scm index 6ff59502..a36dbef9 100644 --- a/module/calp/html/components.scm +++ b/module/calp/html/components.scm @@ -110,26 +110,6 @@ ,@inner-body)])) -(define-public (with-label lbl . forms) - - (define id (gensym "label")) - - (cons `(label (@ (for ,id)) ,lbl) - (let recurse ((forms forms)) - (map (lambda (form) - (cond [(not (list? form)) form] - [(null? form) '()] - [(eq? 'input (car form)) - ((set-attribute `((id ,id))) form)] - [(list? (car form)) - (cons (recurse (car form)) - (recurse (cdr form)))] - [else - (cons (car form) - (recurse (cdr form)))])) - forms)))) - - (define-public (include-css path . extra-attributes) `(link (@ (type "text/css") (rel "stylesheet") -- cgit v1.2.3 From d24c78628003c114c9f37f9203a7de09d8c883d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 03:12:06 +0200 Subject: Escape some unicode in initial xhtml output. While not necessary, since both HTML and XHTML allows for direct UTF-8, the validator fails on it. --- module/calp/html/vcomponent.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'module') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 85c3829c..b7702de1 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -28,6 +28,12 @@ ) +(define (xml-entities s) + (lambda () + (for-each display + (map (lambda (c) (format #f "&#x~x;" (char->integer c))) + (string->list s))))) + (define-public (format-summary ev str) ((summary-filter) ev str)) @@ -595,20 +601,20 @@ (title ,(_ "Fullscreen")) ;; (aria-label "") ) - "🗖") + ,(xml-entities "🗖")) (button (@ (class "remove-button") ;; Remove/Trash the event this popup represent ;; Think garbage can (title ,(_ "Remove"))) - "🗑")) + ,(xml-entities "🗑"))) (tab-group (@ (class "window-body")) (vevent-description - (@ (data-label "📅") (data-title ,(_ "Overview")) + (@ (data-label ,(xml-entities "📅")) (data-title ,(_ "Overview")) (class "vevent"))) (vevent-edit - (@ (data-label "🖊") + (@ (data-label ,(xml-entities "🖊")) (data-title ,(_ "Edit")) ;; Used by JavaScript to target this tab (data-originaltitle "Edit"))) @@ -617,10 +623,10 @@ ;; (@ (data-label "↺") (data-title "Upprepningar"))) (vevent-changelog - (@ (data-label "📒") + (@ (data-label ,(xml-entities "📒")) (data-title ,(_ "Changelog")))) ,@(when (debug) `((vevent-dl - (@ (data-label "🐸") + (@ (data-label ,(xml-entities "🐸")) (data-title ,(_ "Debug")))))))))) -- cgit v1.2.3