aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 19:39:37 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-11 19:39:52 +0200
commitad78b193271abb6df486d3acfd7ab94f51cd101c (patch)
tree5dc061066f266aa650720db56768291f6c4842f9
parentHTML Created events now have a description. (diff)
downloadcalp-ad78b193271abb6df486d3acfd7ab94f51cd101c.tar.gz
calp-ad78b193271abb6df486d3acfd7ab94f51cd101c.tar.xz
Can create events without descriptions again.
-rw-r--r--module/html/view/calendar.scm5
-rw-r--r--module/vcomponent/parse/xcal.scm30
-rw-r--r--static/script.js3
3 files changed, 24 insertions, 14 deletions
diff --git a/module/html/view/calendar.scm b/module/html/view/calendar.scm
index 4753e1e6..f058d01e 100644
--- a/module/html/view/calendar.scm
+++ b/module/html/view/calendar.scm
@@ -318,7 +318,10 @@
dtstart: (datetime)
dtend: (datetime)
summary: "New Event"
- description: "None yet"))))
+ ;; force a description field,
+ ;; but don't put anything in
+ ;; it.
+ description: ""))))
(event (car (children cal))))
`((div (@ (class "template event-container") (id "event-template")
;; Only needed to create a duration. So actual dates
diff --git a/module/vcomponent/parse/xcal.scm b/module/vcomponent/parse/xcal.scm
index 76bdb251..06745864 100644
--- a/module/vcomponent/parse/xcal.scm
+++ b/module/vcomponent/parse/xcal.scm
@@ -126,21 +126,27 @@
(let ((params (handle-parameters parameters))
(tag* (symbol-upcase tag)))
(for (type value) in (zip type value)
- (set! (prop* component tag*)
- (make-vline tag*
- (handle-tag
- tag (handle-value type params value))
- params))))]
+ ;; ignore empty fields
+ ;; mostly for <text/>
+ (unless (null? value)
+ (set! (prop* component tag*)
+ (make-vline tag*
+ (handle-tag
+ tag (handle-value type params value))
+ params)))))]
[(tag (type value ...) ...)
(for (type value) in (zip type value)
- (let ((params (make-hash-table))
- (tag* (symbol-upcase tag)))
- (set! (prop* component tag*)
- (make-vline tag*
- (handle-tag
- tag (handle-value type params value))
- params))))])))
+ ;; ignore empty fields
+ ;; mostly for <text/>
+ (unless (null? value)
+ (let ((params (make-hash-table))
+ (tag* (symbol-upcase tag)))
+ (set! (prop* component tag*)
+ (make-vline tag*
+ (handle-tag
+ tag (handle-value type params value))
+ params)))))])))
;; children
(awhen (assoc-ref sxcal 'components)
diff --git a/static/script.js b/static/script.js
index c2ea07c1..be19dc13 100644
--- a/static/script.js
+++ b/static/script.js
@@ -478,7 +478,8 @@ function place_in_edit_mode (event) {
let description = descs[0];
let textarea = makeElement('textarea', {
name: "description",
- placeholder: description.innerText,
+ placeholder: "Description (optional)",
+ innerHTML: description.innerText,
required: false,
});