aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 17:19:37 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 17:19:37 +0200
commit5a91457a5b8595969957cd6676afc2fff858251e (patch)
treee6204e1c70e41d66a715e27dbf0099c97fe838a0
parentRemove week-start from (html view calendar) (again?) (diff)
downloadcalp-5a91457a5b8595969957cd6676afc2fff858251e.tar.gz
calp-5a91457a5b8595969957cd6676afc2fff858251e.tar.xz
HTML Created events now have a description.
Unfortunately they ALWAYS have a description.
-rw-r--r--module/html/vcomponent.scm5
-rw-r--r--module/html/view/calendar.scm3
-rw-r--r--static/script.js22
3 files changed, 27 insertions, 3 deletions
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)))
diff --git a/module/html/view/calendar.scm b/module/html/view/calendar.scm
index 2371cfe0..4753e1e6 100644
--- a/module/html/view/calendar.scm
+++ b/module/html/view/calendar.scm
@@ -317,7 +317,8 @@
;; cloned mulitple times.
dtstart: (datetime)
dtend: (datetime)
- summary: "New Event"))))
+ summary: "New Event"
+ description: "None yet"))))
(event (car (children cal))))
`((div (@ (class "template event-container") (id "event-template")
;; Only needed to create a duration. So actual dates
diff --git a/static/script.js b/static/script.js
index 32bc3b4b..c2ea07c1 100644
--- a/static/script.js
+++ b/static/script.js
@@ -473,6 +473,28 @@ function place_in_edit_mode (event) {
/* ---------------------------------------- */
+ let descs = popup.getElementsByClassName("description");
+ if (descs.length === 1) {
+ let description = descs[0];
+ let textarea = makeElement('textarea', {
+ name: "description",
+ placeholder: description.innerText,
+ required: false,
+ });
+
+ textarea.oninput = function () {
+ event.properties["description"] = this.value;
+ }
+
+ let slot = event.properties["_slot_description"]
+ let idx = slot.findIndex(e => e[0] === description);
+ slot.splice(idx, 1, [input, (s, v) => s.innerHTML = v])
+
+ description.replaceWith(textarea);
+ }
+
+ /* ---------------------------------------- */
+
let submit = makeElement( 'input', {
type: 'submit',
value: 'Skapa event',