From 255569201bf97859c0fa3a331a08c8694026f97c Mon Sep 17 00:00:00 2001 From: Rasmus Kaj Date: Sun, 20 Feb 2022 15:38:07 +0100 Subject: [PATCH] Improve admin js. Disable the button that opens a currently opened admin subform. --- res/admin.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/res/admin.js b/res/admin.js index 1df197d..860cbfc 100644 --- a/res/admin.js +++ b/res/admin.js @@ -48,8 +48,13 @@ f.appendChild(i); return f; } + function disable_one(one) { + p.querySelectorAll('button').forEach(function(b) { + b.disabled = (b === one); + }) + } function tag_form(event, category) { - //event.target.disabled = true; - FIXME? + disable_one(event.target); var f = makeform(category); var l = d.createElement("label"); l.innerHTML = event.target.title; @@ -151,7 +156,7 @@ } function grade_form(event) { - //event.target.disabled = true; - FIXME? + disable_one(event.target); var grade = details.dataset.grade; var f = makeform("grade"); var l = d.createElement("label"); @@ -202,7 +207,7 @@ } function location_form(event) { - //event.target.disabled = true; - FIXME? + disable_one(event.target); var position = details.dataset.position || localStorage.getItem('lastpos'); var f = makeform("locate");