aboutsummaryrefslogtreecommitdiff
path: root/static/components/vevent-block.ts
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-26 17:14:30 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-26 17:14:30 +0100
commit0cfa00fc43eaf98db8b2461a2d07687b6591cd6e (patch)
tree4a7957e27e6736a2b0d98b47aa443d2caa43ba72 /static/components/vevent-block.ts
parentMinor cleanup. (diff)
downloadcalp-0cfa00fc43eaf98db8b2461a2d07687b6591cd6e.tar.gz
calp-0cfa00fc43eaf98db8b2461a2d07687b6591cd6e.tar.xz
Remove default ComponentVEvent redraw.
Diffstat (limited to 'static/components/vevent-block.ts')
-rw-r--r--static/components/vevent-block.ts19
1 files changed, 18 insertions, 1 deletions
diff --git a/static/components/vevent-block.ts b/static/components/vevent-block.ts
index a4aaba24..de9cf748 100644
--- a/static/components/vevent-block.ts
+++ b/static/components/vevent-block.ts
@@ -23,7 +23,24 @@ class ComponentBlock extends ComponentVEvent {
}
redraw(data: VEvent) {
- super.redraw(data);
+ let body = (this.template.content.cloneNode(true) as DocumentFragment).firstElementChild!;
+
+ for (let el of body.querySelectorAll('[data-property]')) {
+ if (!(el instanceof HTMLElement)) continue;
+ let p = el.dataset.property!;
+ let d, fmt;
+ if ((d = data.getProperty(p))) {
+ if ((fmt = el.dataset.fmt)) {
+ el.textContent = d.format(fmt);
+ } else {
+ el.textContent = d;
+ }
+ }
+ }
+
+ this.replaceChildren(body);
+
+ /* -------------------------------------------------- */
let p;
if ((p = data.getProperty('dtstart'))) {