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'] %} - + -
{% endif %} {% if v.admin_level >= PERMS['USER_AGENDAPOSTER'] %} - + -