From 228c86f792dcb487c923e173c90c995acc09efbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 27 Sep 2020 17:17:55 +0200 Subject: Add new edit tab. --- module/calp/html/vcomponent.scm | 72 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 5 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index c4e15374..8e52ed7c 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -98,17 +98,74 @@ ,(string-map (lambda (c) (if (char=? c #\,) #\newline c)) (prop ev 'LOCATION))))) ,(awhen (prop ev 'DESCRIPTION) - `(span (@ (class "description")) + `(div (@ (class "description")) ,(format-description ev it))) + + ,(awhen (prop ev 'CATEGORIES) + `(div (@ (class "categories")) + ,@(map (lambda (c) + `(a (@ (class "category") + ;; TODO centralize search terms + ;; TODO propper stringifycation of sexp + (href ,(format #f "/search/?q=%28member+%22~a%22%0D%0A++%28or+%28prop+event+%27CATEGORIES%29+%27%28%29%29%0D%0A" + c))) + ,c)) + it))) ,(awhen (prop ev 'RRULE) - `(span (@ (class "rrule")) - ,@(format-recurrence-rule ev))) + `(div (@ (class "rrule")) + ,@(format-recurrence-rule ev))) + ,(when (prop ev 'LAST-MODIFIED) - `(span (@ (class "last-modified")) "Senast ändrad " - ,(datetime->string (prop ev 'LAST-MODIFIED) "~1 ~H:~M")))) + `(div (@ (class "last-modified")) "Senast ändrad " + ,(datetime->string (prop ev 'LAST-MODIFIED) "~1 ~H:~M")))) ))) +(define*-public (fmt-for-edit ev + optional: (attributes '()) + key: (fmt-header list)) + `(div (@ (class " eventtext ")) + (h3 (input (@ (type "text") (class "summary") + (placeholder "Sammanfattning") + (name "summary") (required) + (value ,(prop ev 'SUMMARY))))) + (div + ,(let ((start (prop ev 'DTSTART)) + (end (prop ev 'DTEND))) + `(table + (tr (td "Heldag?") + (td (input (@ (type "checkbox") + ,@(when (date? start) '((checked))))))) + (tr (td "Start") + (td (input (@ (type "date") (value ,(date->string (as-date start)))))) + (td + (input (@ ,@(when (date? start) + '((style "display:none"))) + (type "time") + (value ,(time->string (as-time start))))))) + (tr (td "Slut") + (td (input (@ (type "date") + ,@(when end `((value ,(date->string (as-date end)))))))) + (td (input (@ ,@(when (date? start) + '((style "display:none"))) + (type "time") + ,@(when end `((value ,(time->string (as-time end))))) + ))))))) + + (div (b "Plats: ") + (input (@ (name "location") + (value ,(or (prop ev 'LOCATION) ""))))) + + (div (@ (class "description")) + (textarea ,(prop ev 'DESCRIPTION))) + + (div (@ (class "categories")) + ,@(awhen (prop ev 'CATEGORIES) + (map (lambda (c) `(button (@ (class "category")) ,c)) + it)) + + (input (@ (class "category") (type "text") (placeholder "category")))))) + ;; Single event in side bar (text objects) (define-public (fmt-day day) @@ -238,6 +295,10 @@ ,(tabset `(("📅" title: "Översikt" ,(fmt-single-event ev)) + + ("📅" title: "Redigera" + ,(fmt-for-edit ev)) + ("⤓" title: "Nedladdning" (div (@ (class "eventtext") (style "font-family:sans")) (h2 "Ladda ner") @@ -245,6 +306,7 @@ "som iCal")) (li (a (@ (href "/calendar/" ,(prop ev 'UID) ".xcs")) "som xCal"))))) + ,@(when (prop ev 'RRULE) `(("↺" title: "Upprepningar" class: "repeating" ,(repeat-info ev))))))))) -- cgit v1.2.3 From 7c4dda4f90a1929dde13b254ae6f1e5a766cc7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 27 Sep 2020 20:53:35 +0200 Subject: Input cleaned up. --- module/calp/html/vcomponent.scm | 87 +++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 37 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 8e52ed7c..89020bd8 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -7,7 +7,7 @@ :use-module ((text util) :select (add-enumeration-punctuation)) :use-module (calp html util) :use-module ((calp html config) :select (edit-mode)) - :use-module ((calp html components) :select (btn tabset)) + :use-module ((calp html components) :select (btn tabset form with-label)) :use-module ((calp util color) :select (calculate-fg-color)) :use-module ((vcomponent datetime output) :select (fmt-time-span @@ -125,46 +125,59 @@ optional: (attributes '()) key: (fmt-header list)) `(div (@ (class " eventtext ")) - (h3 (input (@ (type "text") (class "summary") - (placeholder "Sammanfattning") - (name "summary") (required) - (value ,(prop ev 'SUMMARY))))) - (div - ,(let ((start (prop ev 'DTSTART)) - (end (prop ev 'DTEND))) - `(table - (tr (td "Heldag?") - (td (input (@ (type "checkbox") - ,@(when (date? start) '((checked))))))) - (tr (td "Start") - (td (input (@ (type "date") (value ,(date->string (as-date start)))))) - (td - (input (@ ,@(when (date? start) - '((style "display:none"))) - (type "time") - (value ,(time->string (as-time start))))))) - (tr (td "Slut") - (td (input (@ (type "date") - ,@(when end `((value ,(date->string (as-date end)))))))) - (td (input (@ ,@(when (date? start) - '((style "display:none"))) - (type "time") - ,@(when end `((value ,(time->string (as-time end))))) - ))))))) + (div (@ (class "edit-form")) + (h3 (input (@ (type "text") (class "summary") + (placeholder "Sammanfattning") + (name "summary") (required) + (value ,(prop ev 'SUMMARY))))) + + ,@(with-label "Heldag" `(input (@ (name "wholeday") (type "checkbox")))) + + ,@(let ((start (prop ev 'DTSTART))) + (with-label "Start" + `(div (input (@ (type "date") + (name "dtstart-date") + (value ,(date->string (as-date start))))) + (input (@ ,@(when (date? start) + '((style "display:none"))) + (type "time") + (name "dtstart-end") + (value ,(time->string (as-time start)))))))) + ,@(let ((end (prop ev 'DTEND))) + (with-label "Slut" + `(div (input (@ (type "date") + (name "dtend-date") + ,@(when end `((value ,(date->string (as-date end))))))) + (input (@ ,@(when (date? end) + '((style "display:none"))) + (type "time") + (name "dtend-time") + ,@(when end `((value ,(time->string (as-time end))))) + ))))) - (div (b "Plats: ") - (input (@ (name "location") - (value ,(or (prop ev 'LOCATION) ""))))) + ,@(with-label + "Plats" + `(input (@ (placeholder "Plats") + (name "location") + (type "text") + (value ,(or (prop ev 'LOCATION) ""))))) - (div (@ (class "description")) - (textarea ,(prop ev 'DESCRIPTION))) + ,@(with-label + "Beskrivning" + `(textarea (@ (placeholder "Beskrivning") + (name "description")) + ,(prop ev 'DESCRIPTION))) - (div (@ (class "categories")) - ,@(awhen (prop ev 'CATEGORIES) - (map (lambda (c) `(button (@ (class "category")) ,c)) - it)) + ,@(with-label + "Kategorier" + (awhen (prop ev 'CATEGORIES) + (map (lambda (c) `(button (@ (class "category")) ,c)) + it)) - (input (@ (class "category") (type "text") (placeholder "category")))))) + `(input (@ (class "category") + (type "text") + (placeholder "category")))) + ))) ;; Single event in side bar (text objects) -- cgit v1.2.3 From b3250ac8289e4f4154682680d89c417f9a115e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 27 Sep 2020 23:17:01 +0200 Subject: Add fancy editing of tag list. --- module/calp/html/vcomponent.scm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 89020bd8..67634492 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -131,7 +131,7 @@ (name "summary") (required) (value ,(prop ev 'SUMMARY))))) - ,@(with-label "Heldag" `(input (@ (name "wholeday") (type "checkbox")))) + ,@(with-label "Heldag?" `(input (@ (name "wholeday") (type "checkbox")))) ,@(let ((start (prop ev 'DTSTART))) (with-label "Start" @@ -170,13 +170,19 @@ ,@(with-label "Kategorier" - (awhen (prop ev 'CATEGORIES) - (map (lambda (c) `(button (@ (class "category")) ,c)) - it)) + `(div (@ (class "inline-edit")) + ,@(awhen (prop ev 'CATEGORIES) + (map (lambda (c) + `(input (@ (size 2) + (value ,c)))) + it)) - `(input (@ (class "category") - (type "text") - (placeholder "category")))) + (input (@ (class "final") + (size 2) + (type "text") + )))) + + (input (@ (type "submit"))) ))) -- cgit v1.2.3 From 6ad74ec3383b7a8d8403cdf185caabd4332109a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 28 Sep 2020 01:01:45 +0200 Subject: Made timeinput checkbox needlesly fancy. --- module/calp/html/vcomponent.scm | 134 ++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 59 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 67634492..54bfb9e8 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -125,65 +125,81 @@ optional: (attributes '()) key: (fmt-header list)) `(div (@ (class " eventtext ")) - (div (@ (class "edit-form")) - (h3 (input (@ (type "text") (class "summary") - (placeholder "Sammanfattning") - (name "summary") (required) - (value ,(prop ev 'SUMMARY))))) - - ,@(with-label "Heldag?" `(input (@ (name "wholeday") (type "checkbox")))) - - ,@(let ((start (prop ev 'DTSTART))) - (with-label "Start" - `(div (input (@ (type "date") - (name "dtstart-date") - (value ,(date->string (as-date start))))) - (input (@ ,@(when (date? start) - '((style "display:none"))) - (type "time") - (name "dtstart-end") - (value ,(time->string (as-time start)))))))) - ,@(let ((end (prop ev 'DTEND))) - (with-label "Slut" - `(div (input (@ (type "date") - (name "dtend-date") - ,@(when end `((value ,(date->string (as-date end))))))) - (input (@ ,@(when (date? end) - '((style "display:none"))) - (type "time") - (name "dtend-time") - ,@(when end `((value ,(time->string (as-time end))))) - ))))) - - ,@(with-label - "Plats" - `(input (@ (placeholder "Plats") - (name "location") - (type "text") - (value ,(or (prop ev 'LOCATION) ""))))) - - ,@(with-label - "Beskrivning" - `(textarea (@ (placeholder "Beskrivning") - (name "description")) - ,(prop ev 'DESCRIPTION))) - - ,@(with-label - "Kategorier" - `(div (@ (class "inline-edit")) - ,@(awhen (prop ev 'CATEGORIES) - (map (lambda (c) - `(input (@ (size 2) - (value ,c)))) - it)) - - (input (@ (class "final") - (size 2) - (type "text") - )))) - - (input (@ (type "submit"))) - ))) + (form (@ (class "edit-form")) + (h3 (input (@ (type "text") + (placeholder "Sammanfattning") + (name "summary") (required) + (value ,(prop ev 'SUMMARY))))) + + ,(let ((start (prop ev 'DTSTART)) + (end (prop ev 'DTEND))) + `(div (@ (class "timeinput")) + + (input (@ (type "date") + (name "dtstart-date") + (style "grid-column:1;grid-row:2") + (value ,(date->string (as-date start))))) + + (input (@ (type "date") + (name "dtend-date") + (style "grid-column:1;grid-row:3") + ,@(when end `((value ,(date->string (as-date end))))))) + + ,@(with-label + "Heldag?" + `(input (@ (type "checkbox") (style "display:none") + (name "wholeday")))) + + (input (@ ,@(when (date? start) + '((style "display:none"))) + (type "time") + (name "dtstart-end") + (style "grid-column:3;grid-row:2") + (value ,(time->string (as-time start))))) + + (input (@ ,@(when (date? end) + '((style "display:none"))) + (type "time") + (name "dtend-time") + (style "grid-column:3;grid-row:3") + ,@(when end `((value ,(time->string (as-time end))))) + )))) + + ,@(with-label + "Plats" + `(input (@ (placeholder "Plats") + (name "location") + (type "text") + (value ,(or (prop ev 'LOCATION) ""))))) + + ,@(with-label + "Beskrivning" + `(textarea (@ (placeholder "Beskrivning") + (name "description")) + ,(prop ev 'DESCRIPTION))) + + ,@(with-label + "Kategorier" + `(div (@ (class "inline-edit")) + ,@(awhen (prop ev 'CATEGORIES) + (map (lambda (c) + `(input (@ (size 2) + (value ,c)))) + it)) + + (input (@ (class "final") + (size 2) + (type "text") + )))) + + #; + (input (@ (type "text") + (list "known-fields") + (placeholder "Nytt fält"))) + + + (input (@ (type "submit"))) + ))) ;; Single event in side bar (text objects) -- cgit v1.2.3 From 04dcab7a429d9b034d41b5aca8bd715c4826de32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 28 Sep 2020 03:10:54 +0200 Subject: Groundwork for adding new fields from frontend. --- module/calp/html/vcomponent.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 54bfb9e8..2497aa04 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -192,10 +192,19 @@ (type "text") )))) - #; - (input (@ (type "text") - (list "known-fields") - (placeholder "Nytt fält"))) + (hr) + + (div (@ (class "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"))) -- cgit v1.2.3 From 0e6050122d78ce427715deb0b08ed26fc4af1c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 2 Oct 2020 00:35:20 +0200 Subject: Fix XML double attribute error. --- module/calp/html/vcomponent.scm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 2497aa04..7a4de873 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -150,18 +150,16 @@ `(input (@ (type "checkbox") (style "display:none") (name "wholeday")))) - (input (@ ,@(when (date? start) - '((style "display:none"))) - (type "time") + (input (@ (type "time") (name "dtstart-end") - (style "grid-column:3;grid-row:2") + (style "grid-column:3;grid-row:2;" + ,(when (date? start) "display:none")) (value ,(time->string (as-time start))))) - (input (@ ,@(when (date? end) - '((style "display:none"))) - (type "time") + (input (@ (type "time") (name "dtend-time") - (style "grid-column:3;grid-row:3") + (style "grid-column:3;grid-row:3;" + ,(when (date? end) "display:none")) ,@(when end `((value ,(time->string (as-time end))))) )))) -- cgit v1.2.3 From f533f5050bb4899e18dc1656458697b1d277dd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 2 Oct 2020 16:49:43 +0200 Subject: Binding of fields in edit tab work. --- module/calp/html/vcomponent.scm | 50 ++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 7a4de873..0f8014db 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -56,18 +56,21 @@ ;; (format (current-error-port) "fmt-single-event: ~a~%" (prop ev 'X-HNH-FILENAME)) `(div (@ ,@(assq-merge attributes - `((class " eventtext " + `((class " eventtext summary-tab " ,(when (and (prop ev 'PARTSTAT) (eq? 'TENTATIVE (prop ev 'PARTSTAT))) " tentative "))))) (h3 ,(fmt-header (when (prop ev 'RRULE) `(span (@ (class "repeating")) "↺")) - `(span (@ (class "summary")) ,(prop ev 'SUMMARY)))) + `(span (@ (class "bind summary") + (data-property "summary")) + ,(prop ev 'SUMMARY)))) (div ,(call-with-values (lambda () (fmt-time-span ev)) (case-lambda [(start) - `(div (time (@ (class "dtstart") + `(div (time (@ (class "bind dtstart") + (data-property "dtstart") (data-fmt ,(string-append "~L" start)) (datetime ,(datetime->string (as-datetime (prop ev 'DTSTART)) @@ -76,7 +79,8 @@ (as-datetime (prop ev 'DTSTART)) start)))] [(start end) - `(div (time (@ (class "dtstart") + `(div (time (@ (class "bind dtstart") + (data-property "dtstart") (data-fmt ,(string-append "~L" start)) (datetime ,(datetime->string (as-datetime (prop ev 'DTSTART)) @@ -84,23 +88,30 @@ ,(datetime->string (as-datetime (prop ev 'DTSTART)) start)) " — " - (time (@ (class "dtend") + (time (@ (class "bind dtend") + (data-property "dtend") (data-fmt ,(string-append "~L" end)) (datetime ,(datetime->string (as-datetime (prop ev 'DTSTART)) "~1T~3"))) ,(datetime->string (as-datetime (prop ev 'DTEND)) end)))])) + + ;; TODO add optional fields when added in frontend + ;; Possibly by always having them here, just hidden. + (div (@ (class "fields")) ,(when (and=> (prop ev 'LOCATION) (negate string-null?)) `(div (b "Plats: ") - (div (@ (class "location")) + (div (@ (class "bind location") (data-property "location")) ,(string-map (lambda (c) (if (char=? c #\,) #\newline c)) (prop ev 'LOCATION))))) ,(awhen (prop ev 'DESCRIPTION) - `(div (@ (class "description")) + `(div (@ (class "bind description") + (data-property "description")) ,(format-description ev it))) + ;; TODO add bind once I figure out how to bind lists ,(awhen (prop ev 'CATEGORIES) `(div (@ (class "categories")) ,@(map (lambda (c) @@ -111,6 +122,8 @@ c))) ,c)) it))) + + ;; TODO bind ,(awhen (prop ev 'RRULE) `(div (@ (class "rrule")) ,@(format-recurrence-rule ev))) @@ -124,11 +137,12 @@ (define*-public (fmt-for-edit ev optional: (attributes '()) key: (fmt-header list)) - `(div (@ (class " eventtext ")) + `(div (@ (class " eventtext edit-tab ")) (form (@ (class "edit-form")) (h3 (input (@ (type "text") (placeholder "Sammanfattning") (name "summary") (required) + (class "bind") (data-property "summary") (value ,(prop ev 'SUMMARY))))) ,(let ((start (prop ev 'DTSTART)) @@ -138,11 +152,15 @@ (input (@ (type "date") (name "dtstart-date") (style "grid-column:1;grid-row:2") + (class "bind") + (data-property "--dtstart-date") (value ,(date->string (as-date start))))) (input (@ (type "date") (name "dtend-date") (style "grid-column:1;grid-row:3") + (class "bind") + (data-property "--dtend-date") ,@(when end `((value ,(date->string (as-date end))))))) ,@(with-label @@ -151,13 +169,17 @@ (name "wholeday")))) (input (@ (type "time") - (name "dtstart-end") + (name "dtstart-time") + (class "bind") + (data-property "--dtstart-time") (style "grid-column:3;grid-row:2;" ,(when (date? start) "display:none")) (value ,(time->string (as-time start))))) (input (@ (type "time") (name "dtend-time") + (class "bind") + (data-property "--dtend-time") (style "grid-column:3;grid-row:3;" ,(when (date? end) "display:none")) ,@(when end `((value ,(time->string (as-time end))))) @@ -168,11 +190,13 @@ `(input (@ (placeholder "Plats") (name "location") (type "text") + (class "bind") (data-property "location") (value ,(or (prop ev 'LOCATION) ""))))) ,@(with-label "Beskrivning" `(textarea (@ (placeholder "Beskrivning") + (class "bind") (data-property "description") (name "description")) ,(prop ev 'DESCRIPTION))) @@ -190,6 +214,8 @@ (type "text") )))) + ;; TODO extra fields + (hr) (div (@ (class "newfield")) @@ -275,10 +301,12 @@ (div (@ (class "event-body")) ,(when (prop ev 'RRULE) `(span (@ (class "repeating")) "↺")) - (span (@ (class "summary")) + (span (@ (class "bind summary") + (data-property "summary")) ,(format-summary ev (prop ev 'SUMMARY))) ,(when (prop ev 'LOCATION) - `(span (@ (class "location")) + `(span (@ (class "bind location") + (data-property "location")) ,(string-map (lambda (c) (if (char=? c #\,) #\newline c)) (prop ev 'LOCATION))))) (div (@ (style "display:none !important;")) -- cgit v1.2.3 From 7fd091319ee3cca1abea5e7bfcd3e6271f452015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 5 Oct 2020 02:44:28 +0200 Subject: Remove old edit mode. --- module/calp/html/vcomponent.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 0f8014db..7414654b 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -139,6 +139,7 @@ key: (fmt-header list)) `(div (@ (class " eventtext edit-tab ")) (form (@ (class "edit-form")) + (div (@ (class "dropdown-goes-here"))) (h3 (input (@ (type "text") (placeholder "Sammanfattning") (name "summary") (required) -- cgit v1.2.3 From 81740400f9bcf10a384f3f143a02b3bdeba0c2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 16 Oct 2020 23:09:11 +0200 Subject: s/inline-edit/input-list/ --- module/calp/html/vcomponent.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 7414654b..cf8f3a9d 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -203,7 +203,7 @@ ,@(with-label "Kategorier" - `(div (@ (class "inline-edit")) + `(div (@ (class "input-list")) ,@(awhen (prop ev 'CATEGORIES) (map (lambda (c) `(input (@ (size 2) -- cgit v1.2.3 From 28c560c4c11f51b2dfffc77a286ad03057e4a13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 23 Oct 2020 00:14:17 +0200 Subject: Work on generalizing multi-input lists. --- module/calp/html/vcomponent.scm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index cf8f3a9d..208b66f7 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -207,27 +207,28 @@ ,@(awhen (prop ev 'CATEGORIES) (map (lambda (c) `(input (@ (size 2) + (class "unit") (value ,c)))) it)) - (input (@ (class "final") + (input (@ (class "unit final") (size 2) (type "text") )))) - ;; TODO extra fields - (hr) - (div (@ (class "newfield")) - (input (@ (type "text") - (list "known-fields") - (placeholder "Nytt fält"))) - (select (@ (name "TYPE")) - (option (@ (value "TEXT")) "Text")) - (span + ;; For custom user fields + (div (@ (class "input-list")) + (div (@ (class "unit final newfield")) (input (@ (type "text") - (placeholder "Värde"))))) + (list "known-fields") + (placeholder "Nytt fält"))) + (select (@ (name "TYPE")) + (option (@ (value "TEXT")) "Text")) + (span + (input (@ (type "text") + (placeholder "Värde")))))) (hr) -- cgit v1.2.3 From 2ee958354c18d91a8bd44028042bb4a4a10c423a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 26 Oct 2020 20:30:22 +0100 Subject: HTML Prettyify code for following tags. --- module/calp/html/vcomponent.scm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 208b66f7..6b9a48e9 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -5,6 +5,7 @@ :use-module (srfi srfi-41) :use-module (datetime) :use-module ((text util) :select (add-enumeration-punctuation)) + :use-module ((web uri-query) :select (encode-query-parameters)) :use-module (calp html util) :use-module ((calp html config) :select (edit-mode)) :use-module ((calp html components) :select (btn tabset form with-label)) @@ -117,9 +118,13 @@ ,@(map (lambda (c) `(a (@ (class "category") ;; TODO centralize search terms - ;; TODO propper stringifycation of sexp - (href ,(format #f "/search/?q=%28member+%22~a%22%0D%0A++%28or+%28prop+event+%27CATEGORIES%29+%27%28%29%29%0D%0A" - c))) + (href + "/search/?" + ,(encode-query-parameters + `((q . (member + ,(->quoted-string c) + (or (prop event 'CATEGORIES) + '()))))))) ,c)) it))) -- cgit v1.2.3 From 25eda56e1bccf772c333ee1f649f2627a197cee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 5 Nov 2020 23:43:56 +0100 Subject: Bound CATEGORIES input. --- module/calp/html/vcomponent.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index 6b9a48e9..a32899b1 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -208,7 +208,14 @@ ,@(with-label "Kategorier" - `(div (@ (class "input-list")) + ;; 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) -- cgit v1.2.3 From 3ce851f22bf5a13366e7496971602dff00ca0f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 5 Nov 2020 23:45:33 +0100 Subject: Add comment about freeform fields. --- module/calp/html/vcomponent.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'module/calp/html/vcomponent.scm') diff --git a/module/calp/html/vcomponent.scm b/module/calp/html/vcomponent.scm index a32899b1..fbf344b0 100644 --- a/module/calp/html/vcomponent.scm +++ b/module/calp/html/vcomponent.scm @@ -231,6 +231,11 @@ (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") -- cgit v1.2.3