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 | |
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')
-rw-r--r-- | static/components/vevent-edit.ts | 25 | ||||
-rw-r--r-- | static/globals.ts | 15 |
2 files changed, 23 insertions, 17 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; diff --git a/static/globals.ts b/static/globals.ts index 6b689697..cb65d953 100644 --- a/static/globals.ts +++ b/static/globals.ts @@ -33,18 +33,3 @@ function find_block(uid: uid): ComponentBlock | null { // throw 'Popup not fonud'; return null; } - - - - - - - - -/* -function wholeday_checkbox(box: HTMLInputElement) { - box.closest('.timeinput')! - .querySelectorAll('input[is="date-time"]') - .forEach((el) => { (el as DateTimeInput).dateonly = box.checked }); -} -*/ |