diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-10-05 02:24:04 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-10-05 02:24:04 +0200 |
commit | 61ebd0064fa6660667ca42ea54a169b629344034 (patch) | |
tree | ab7576cf993a569af6f0a51f4b1661585dc19925 | |
parent | Simplify /insert endpoint. (diff) | |
download | calp-61ebd0064fa6660667ca42ea54a169b629344034.tar.gz calp-61ebd0064fa6660667ca42ea54a169b629344034.tar.xz |
Location and Property can now be added.
Diffstat (limited to '')
-rw-r--r-- | static/script.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/static/script.js b/static/script.js index fa9ef210..f116deaf 100644 --- a/static/script.js +++ b/static/script.js @@ -994,6 +994,29 @@ function bind_properties (el, wide_event=false) { } } + /* Dynamicly add or remove the <location/> and <description/> elements + from the <vevent><properties/> list. + + TODO generalize this to all fields, /especially/ those which are + dynamicly added. + */ + for (let field of ['location', 'description']) { + get_property(el, field).push( + [el.querySelector('vevent > properties'), + (s, v) => { + let slot = s.querySelector(field); + if (v === '' && slot) { + slot.remove(); + } else { + if (! slot) { + /* finns det verkligen inget bättre sätt... */ + s.innerHTML += `<${field}><text/></${field}>`; + } + s.querySelector(`${field} > text`).innerHTML = v; + } + }]); + } + /* set up graphical display changes */ let container = el.closest(".event-container"); if (container === null) { |