aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-10-16 22:25:20 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-10-16 23:28:34 +0200
commit773590f4ac6a12bd30361c0e8c9471e04fc95a3f (patch)
tree1c491a97b4010ae6ae2025fa89b4947c5296af8c
parentMinor cleaup. (diff)
downloadcalp-773590f4ac6a12bd30361c0e8c9471e04fc95a3f.tar.gz
calp-773590f4ac6a12bd30361c0e8c9471e04fc95a3f.tar.xz
Fix that events where submitted twice.
-rw-r--r--static/components/vevent-edit.ts37
1 files changed, 21 insertions, 16 deletions
diff --git a/static/components/vevent-edit.ts b/static/components/vevent-edit.ts
index 686ad5e8..6ac91c9f 100644
--- a/static/components/vevent-edit.ts
+++ b/static/components/vevent-edit.ts
@@ -25,6 +25,11 @@ class ComponentEdit extends ComponentVEvent {
let body = frag.firstElementChild!
this.replaceChildren(body);
+ let data = vcal_objects.get(this.uid)
+ if (!data) {
+ throw `Data missing for uid ${this.dataset.uid}.`
+ }
+
for (let el of this.querySelectorAll('[data-label]')) {
let label = document.createElement('label');
let id = el.id || gensym('input');
@@ -32,21 +37,6 @@ class ComponentEdit extends ComponentVEvent {
label.htmlFor = id;
label.textContent = (el as HTMLElement).dataset.label!;
}
- }
-
- connectedCallback() {
-
- /* Edit tab is rendered here. It's left blank server-side, since
- it only makes sense to have something here if we have javascript */
-
- let data = vcal_objects.get(this.uid)
-
- if (!data) {
- throw `Data missing for uid ${this.dataset.uid}.`
- }
-
-
- // return;
/* Handle calendar dropdown */
for (let el of this.querySelectorAll('select.calendar-selection')) {
@@ -64,7 +54,6 @@ class ComponentEdit extends ComponentVEvent {
});
}
- this.redraw(data);
// for (let el of this.getElementsByClassName("interactive")) {
for (let el of this.querySelectorAll("[data-property]")) {
@@ -133,6 +122,22 @@ class ComponentEdit extends ComponentVEvent {
});
}
+ connectedCallback() {
+
+ /* Edit tab is rendered here. It's left blank server-side, since
+ it only makes sense to have something here if we have javascript */
+
+ let data = vcal_objects.get(this.uid)
+
+ if (!data) {
+ throw `Data missing for uid ${this.dataset.uid}.`
+ }
+
+ this.redraw(data);
+
+ // return;
+ }
+
redraw(data: VEvent) {
/* We only update our fields, instead of reinstansiating
ourselves from the template, in hope that it's faster */