diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-23 01:39:08 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-23 01:39:08 +0200 |
commit | 327b322b9583f760cd02ddad7a2a8890df26cc8b (patch) | |
tree | d0a73d5df0011233f3eaa5d9a54d1317fad50bbc /static/components/popup-element.ts | |
parent | Minor cleanup in recurrence generate. (diff) | |
download | calp-uid-stuff-2.tar.gz calp-uid-stuff-2.tar.xz |
workuid-stuff-2
Diffstat (limited to 'static/components/popup-element.ts')
-rw-r--r-- | static/components/popup-element.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/static/components/popup-element.ts b/static/components/popup-element.ts index 3300f885..5dc627d0 100644 --- a/static/components/popup-element.ts +++ b/static/components/popup-element.ts @@ -15,12 +15,12 @@ class PopupElement extends ComponentVEvent { * the top, and allowing global keyboard bindings to affect it. */ static activePopup: PopupElement | null = null; - constructor(uid?: string) { - super(uid); + constructor(uid?: string, instance?: string) { + super(uid, instance); /* TODO populate remaining (??) */ - let obj = vcal_objects.get(this.uid); + let obj = this.getData(); if (obj && obj.calendar) { this.dataset.calendar = obj.calendar; } @@ -48,8 +48,6 @@ class PopupElement extends ComponentVEvent { let template = document.getElementById('popup-template') as HTMLTemplateElement let body = (template.content.cloneNode(true) as DocumentFragment).firstElementChild!; - let uid = this.uid; - /* nav bar */ let nav = body.getElementsByClassName("popup-control")[0] as HTMLElement; bind_popup_control(nav); @@ -61,7 +59,8 @@ class PopupElement extends ComponentVEvent { maximize_btn.addEventListener('click', () => this.maximize()); let remove_btn = body.querySelector('.popup-control .remove-button') as HTMLButtonElement - remove_btn.addEventListener('click', () => remove_event(uid)); + /* TODO repeating removal */ + remove_btn.addEventListener('click', () => remove_event(this.uid)); /* end nav bar */ this.replaceChildren(body); @@ -147,7 +146,7 @@ class PopupElement extends ComponentVEvent { */ function setup_popup_element(ev: VEvent): PopupElement { let uid = ev.getProperty('uid'); - let popup = new PopupElement(uid); + let popup = new PopupElement(uid, ev.getProperty('dtstart')?.format('~Y-~m-~dT~H:~M:~S')); ev.register(popup); /* TODO propper way to find popup container */ (document.querySelector('.days') as Element).appendChild(popup); |