aboutsummaryrefslogtreecommitdiff
path: root/static/components
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-29 21:18:25 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-29 21:48:59 +0100
commit3e8902476dd6436d2b792be9d8ddaf044646016e (patch)
tree6ef67481862d2396461b810c3a30acb2ea03d106 /static/components
parentDisplay categories in event description. (diff)
downloadcalp-3e8902476dd6436d2b792be9d8ddaf044646016e.tar.gz
calp-3e8902476dd6436d2b792be9d8ddaf044646016e.tar.xz
Change UID resolve.
Diffstat (limited to 'static/components')
-rw-r--r--static/components/popup-element.ts3
-rw-r--r--static/components/vevent.ts26
2 files changed, 23 insertions, 6 deletions
diff --git a/static/components/popup-element.ts b/static/components/popup-element.ts
index e26ae578..f4b934d8 100644
--- a/static/components/popup-element.ts
+++ b/static/components/popup-element.ts
@@ -47,9 +47,6 @@ class PopupElement extends ComponentVEvent {
let uid = this.uid;
- body.getElementsByClassName('populate-with-uid')
- .forEach((e) => e.setAttribute('data-uid', uid));
-
window.setTimeout(() => {
/* tab change button */
diff --git a/static/components/vevent.ts b/static/components/vevent.ts
index 561051fa..a7fe3e08 100644
--- a/static/components/vevent.ts
+++ b/static/components/vevent.ts
@@ -17,9 +17,29 @@ abstract class ComponentVEvent extends HTMLElement {
super();
this.template = document.getElementById(this.tagName) as HTMLTemplateElement;
+
let real_uid;
- if (this.dataset.uid) uid = this.dataset.uid;
- if (uid) real_uid = uid;
+
+ console.log(this.tagName);
+ if (uid) {
+ console.log('Got UID directly');
+ real_uid = uid;
+ } else {
+ /* I know that this case is redundant, it's here if we don't want to
+ look up the tree later */
+ if (this.dataset.uid) {
+ console.log('Had UID as direct attribute');
+ real_uid = this.dataset.uid;
+ } else {
+ let el = this.closest('[data-uid]')
+ if (el) {
+ console.log('Found UID higher up in the tree');
+ real_uid = (el as HTMLElement).dataset.uid
+ } else {
+ throw "No parent with [data-uid] set"
+ }
+ }
+ }
if (!real_uid) {
console.warn(this.outerHTML);
@@ -27,7 +47,7 @@ abstract class ComponentVEvent extends HTMLElement {
}
this.uid = real_uid;
- this.dataset.uid = uid;
+ this.dataset.uid = real_uid;
vcal_objects.get(this.uid)?.register(this);