diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-11-18 21:39:49 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-11-18 21:39:49 +0100 |
commit | 8346e5b938c2a01128e8806dbe2b57e4266c51a2 (patch) | |
tree | dd700ad115e6a7272265079e618e63ca1fa5c509 /static/components/vevent-edit.ts | |
parent | Various fixes <date-time-input/> (diff) | |
download | calp-8346e5b938c2a01128e8806dbe2b57e4266c51a2.tar.gz calp-8346e5b938c2a01128e8806dbe2b57e4266c51a2.tar.xz |
Remove .interactive, fix date-time checkbox.
Diffstat (limited to 'static/components/vevent-edit.ts')
-rw-r--r-- | static/components/vevent-edit.ts | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/static/components/vevent-edit.ts b/static/components/vevent-edit.ts index b9c76dd3..e393b1ce 100644 --- a/static/components/vevent-edit.ts +++ b/static/components/vevent-edit.ts @@ -52,7 +52,8 @@ class ComponentEdit extends ComponentVEvent { this.redraw(data); - for (let el of this.getElementsByClassName("interactive")) { + // for (let el of this.getElementsByClassName("interactive")) { + for (let el of this.querySelectorAll("[data-property]")) { // console.log(el); el.addEventListener('input', () => { let obj = vcal_objects.get(this.uid) @@ -70,6 +71,25 @@ class ComponentEdit extends ComponentVEvent { }); } + let wholeday_ = this.querySelector('[name="wholeday"]') + if (wholeday_) { + let wholeday = wholeday_ as HTMLInputElement + + if (data.getProperty('dtstart')?.dateonly) { + wholeday.checked = true; + } + + wholeday.addEventListener('click', () => { + let chk = wholeday.checked + let start = data!.getProperty('dtstart') + let end = data!.getProperty('dtend') + start.dateonly = chk + end.dateonly = chk + data!.setProperty('dtstart', start); + data!.setProperty('dtend', end); + }); + } + let submit = this.querySelector('form') as HTMLFormElement submit.addEventListener('submit', (e) => { console.log(submit, e); @@ -84,7 +104,8 @@ class ComponentEdit extends ComponentVEvent { /* We only update our fields, instead of reinstansiating ourselves from the template, in hope that it's faster */ - for (let el of this.getElementsByClassName("interactive")) { + + for (let el of this.querySelectorAll("[data-property]")) { if (!(el instanceof HTMLElement)) continue; let p = el.dataset.property!; let d: any; |