aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-12-10 00:13:15 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-12-10 00:13:15 +0100
commit5211cea181bbdf9c5296f09806c3735197bc2042 (patch)
tree1b0dad1db73330e4c237885100e463f5cae99e64 /static
parentBetter handling of popup visibility. (diff)
downloadcalp-5211cea181bbdf9c5296f09806c3735197bc2042.tar.gz
calp-5211cea181bbdf9c5296f09806c3735197bc2042.tar.xz
Close popup on event creation.
Diffstat (limited to 'static')
-rw-r--r--static/components/vevent-block.ts5
-rw-r--r--static/event-creator.ts1
-rw-r--r--static/script.ts12
-rw-r--r--static/server_connect.ts22
4 files changed, 25 insertions, 15 deletions
diff --git a/static/components/vevent-block.ts b/static/components/vevent-block.ts
index de9cf748..0aad19b2 100644
--- a/static/components/vevent-block.ts
+++ b/static/components/vevent-block.ts
@@ -35,6 +35,11 @@ class ComponentBlock extends ComponentVEvent {
} else {
el.textContent = d;
}
+ } else switch (p.toLowerCase()) {
+ /* We lack that property, but might want to set a default here */
+ case 'summary':
+ el.textContent = 'Ny händelse'
+ break;
}
}
diff --git a/static/event-creator.ts b/static/event-creator.ts
index 6be94a9d..3459dba1 100644
--- a/static/event-creator.ts
+++ b/static/event-creator.ts
@@ -65,7 +65,6 @@ class EventCreator {
// let [popup, event] = that.create_empty_event();
// that.event = event;
that.ev = new VEvent();
- that.ev.setProperty('summary', 'Created Event');
that.ev.setProperty('uid', uuid())
that.ev.calendar = window.default_calendar;
diff --git a/static/script.ts b/static/script.ts
index df5e2c97..f378ced1 100644
--- a/static/script.ts
+++ b/static/script.ts
@@ -91,14 +91,14 @@ window.addEventListener('load', function() {
let popup = new PopupElement(uid);
ev.register(popup);
- console.log(popup);
+ // console.log(popup);
(document.querySelector('.days') as Element).appendChild(popup);
+ let tabBtn = popup.querySelector('[role="tab"][title="Redigera"]') as HTMLButtonElement
+ tabBtn.click()
+ let tab = document.getElementById(tabBtn.getAttribute('aria-controls')!)!
+ let input = tab.querySelector('input[name="summary"]') as HTMLInputElement
open_popup(popup);
- // (popup.querySelector("input[name='summary']") as HTMLInputElement).focus();
- // let popupElement = document.getElementById("popup" + event.id);
- // open_popup(popup_from_event(event));
-
- // popupElement.querySelector("input[name='summary']").focus();
+ input.select();
}));
}
diff --git a/static/server_connect.ts b/static/server_connect.ts
index 66410324..61eb4f30 100644
--- a/static/server_connect.ts
+++ b/static/server_connect.ts
@@ -94,7 +94,9 @@ async function create_event(event: VEvent) {
return;
}
- let body = await response.text();
+ /* response from here on is good */
+
+ // let body = await response.text();
/* server is assumed to return an XML document on the form
<properties>
@@ -103,10 +105,10 @@ async function create_event(event: VEvent) {
parse that, and update our own vevent with the data.
*/
- let parser = new DOMParser();
- let return_properties = parser
- .parseFromString(body, 'text/xml')
- .children[0];
+ // let parser = new DOMParser();
+ // let return_properties = parser
+ // .parseFromString(body, 'text/xml')
+ // .children[0];
// let child;
// while ((child = return_properties.firstChild)) {
@@ -120,7 +122,11 @@ async function create_event(event: VEvent) {
// }
// }
- // event.classList.remove("generated");
- // toggle_popup(popup_from);
-
+ for (let r of event.registered) {
+ r.classList.remove('generated');
+ if (r.tagName.toLowerCase() === 'popup-element') {
+ console.log(r);
+ r.removeAttribute('visible');
+ }
+ }
}