diff options
author | silverwind <me@silverwind.io> | 2024-03-29 05:56:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 04:56:01 +0000 |
commit | 8fd15990c5c8980caf2b9ffefc0b3427efacdc04 (patch) | |
tree | f281f3fb6128696b5bba2ae057533fbc37f5c32a /web_src/js/features/admin/common.js | |
parent | 8acc7aab4c254c4819f45e512b86cf5a4255091f (diff) | |
download | gitea-8fd15990c5c8980caf2b9ffefc0b3427efacdc04.tar.gz gitea-8fd15990c5c8980caf2b9ffefc0b3427efacdc04.zip |
Remove fomantic checkbox module (#30162)
CSS is pretty slim already and the `.ui.toggle.checkbox` sliders on
admin page also still work. The only necessary JS is the one that links
`input` and `label` so that it can be toggled via label. All checkboxes
except the markdown ones render at `--checkbox-size: 16px` now.
<img width="174" alt="Screenshot 2024-03-28 at 22 15 10"
src="https://github.com/go-gitea/gitea/assets/115237/3455c1bb-166b-47e4-9847-2d20dd1f04db">
<img width="499" alt="Screenshot 2024-03-28 at 21 00 07"
src="https://github.com/go-gitea/gitea/assets/115237/412be2b3-d5a0-478a-b17b-43e6bc12e8ce">
<img width="83" alt="Screenshot 2024-03-28 at 22 14 34"
src="https://github.com/go-gitea/gitea/assets/115237/d8c89838-a420-4723-8c49-89405bb39474">
---------
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'web_src/js/features/admin/common.js')
-rw-r--r-- | web_src/js/features/admin/common.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js index 8a88996742..f388b1122e 100644 --- a/web_src/js/features/admin/common.js +++ b/web_src/js/features/admin/common.js @@ -218,17 +218,24 @@ export function initAdminCommon() { }); // Select actions - const $checkboxes = $('.select.table .ui.checkbox'); + const checkboxes = document.querySelectorAll('.select.table .ui.checkbox input'); + $('.select.action').on('click', function () { switch ($(this).data('action')) { case 'select-all': - $checkboxes.checkbox('check'); + for (const checkbox of checkboxes) { + checkbox.checked = true; + } break; case 'deselect-all': - $checkboxes.checkbox('uncheck'); + for (const checkbox of checkboxes) { + checkbox.checked = false; + } break; case 'inverse': - $checkboxes.checkbox('toggle'); + for (const checkbox of checkboxes) { + checkbox.checked = !checkbox.checked; + } break; } }); @@ -236,11 +243,11 @@ export function initAdminCommon() { e.preventDefault(); this.classList.add('is-loading', 'disabled'); const data = new FormData(); - $checkboxes.each(function () { - if ($(this).checkbox('is checked')) { - data.append('ids[]', this.getAttribute('data-id')); + for (const checkbox of checkboxes) { + if (checkbox.checked) { + data.append('ids[]', checkbox.closest('.ui.checkbox').getAttribute('data-id')); } - }); + } await POST(this.getAttribute('data-link'), {data}); window.location.href = this.getAttribute('data-redirect'); }); |