diff options
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'); }); |