diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-11 20:05:56 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-11 20:05:56 +0200 |
commit | aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3 (patch) | |
tree | c82eea859f7aac03f0e8daa5cbec7ff461411bf6 | |
parent | Keep summary when editing existing elements. (diff) | |
download | calp-aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3.tar.gz calp-aa18e57dfdf2bd0f626d7101ab712e6a0ff6dbf3.tar.xz |
Focus summary when editing existing.
Diffstat (limited to '')
-rw-r--r-- | module/entry-points/server.scm | 3 | ||||
-rw-r--r-- | static/script.js | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm index 466860cd..dc675813 100644 --- a/module/entry-points/server.scm +++ b/module/entry-points/server.scm @@ -163,6 +163,9 @@ (format #f "No event with UID '~a'" uid)))) ;; TODO this fails when dtstart is <date>. + ;; TODO If data has an explicit UID and that UID already exists we + ;; overwrite it in the database. We however don't remove the old + ;; event from the in-memory set, but rather just adds the new. (POST "/insert" (cal data) (unless (and cal data) diff --git a/static/script.js b/static/script.js index 7f9291d7..5b6f561a 100644 --- a/static/script.js +++ b/static/script.js @@ -475,6 +475,10 @@ function place_in_edit_mode (event) { /* ---------------------------------------- */ + /* TODO add elements if the arent't already there + * Almost all should be direct children of '.event-body'. + * Biggest problem is generated fields relative order. + */ let descs = popup.getElementsByClassName("description"); if (descs.length === 1) { let description = descs[0]; @@ -515,6 +519,11 @@ function place_in_edit_mode (event) { article.replaceWith(wrappingForm); wrappingForm.appendChild(article); + /* this is for existing events. + * Newly created events aren't in the DOM tree yet, and can + * therefore not yet be focused */ + input.focus(); + } window.onload = function () { @@ -558,7 +567,7 @@ window.onload = function () { let popupElement = document.getElementById("popup" + event.id); open_popup(popupElement); - popupElement.querySelector("input[name='summary']").focus(); + popupElement.querySelector("input[name='summary']").focus(); }); } |