From f66fcdc6ce6c9b1fa2154442efb95a1be044d0c9 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 17 Mar 2023 16:23:42 +0200 Subject: [PATCH] make chudding and banning in profiles more seamless --- files/assets/js/admin/core.js | 9 +++++++++ files/assets/js/core.js | 5 +++-- files/templates/userpage/admintools.html | 8 ++++---- files/templates/util/html_head.html | 3 +++ 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 files/assets/js/admin/core.js diff --git a/files/assets/js/admin/core.js b/files/assets/js/admin/core.js new file mode 100644 index 000000000..8113b24d8 --- /dev/null +++ b/files/assets/js/admin/core.js @@ -0,0 +1,9 @@ +function unchud_or_unban(t, url) { + postToast(t, url, + { + }, + () => { + t.classList.add('d-none'); + t.nextElementSibling.classList.remove('d-none'); + }); +} diff --git a/files/assets/js/core.js b/files/assets/js/core.js index fc8658eba..68d9ea5e4 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -325,11 +325,12 @@ function sendFormXHR(form, extraActionsOnSuccess) { xhr.send(formData); } -function sendFormXHRSwitch(form, donthideself) { +function sendFormXHRSwitch(form) { sendFormXHR(form, () => { form.previousElementSibling.classList.remove('d-none'); - if (!donthideself) + const days = form.querySelector("input[name=days]") + if (!days || !days.value) form.classList.add('d-none'); } ) diff --git a/files/templates/userpage/admintools.html b/files/templates/userpage/admintools.html index f0f16ecf6..86bd28134 100644 --- a/files/templates/userpage/admintools.html +++ b/files/templates/userpage/admintools.html @@ -42,9 +42,9 @@ {% endif %} {% if v.admin_level >= PERMS['USER_BAN'] %} - + -
+ @@ -65,9 +65,9 @@
{% endif %} {% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %} - + -
+ diff --git a/files/templates/util/html_head.html b/files/templates/util/html_head.html index bbac0ffcb..3edf15395 100644 --- a/files/templates/util/html_head.html +++ b/files/templates/util/html_head.html @@ -9,6 +9,9 @@ {% macro javascript() %} + {% if v and v.admin_level %} + + {% endif %} {% endmacro %} {% macro page_meta(title=none) %}