Skip to content

Commit 1551d73

Browse files
Remove jQuery class from the common admin functions (#30137)
- Switched from jQuery class functions to plain JavaScript `classList` - Tested the new authentication source form and the deletion of system notices. They work as before Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: Giteabot <[email protected]>
1 parent 1a71dbf commit 1551d73

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

web_src/js/features/admin/common.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export function initAdminCommon() {
122122
input.removeAttribute('required');
123123
}
124124

125-
$('.binddnrequired').removeClass('required');
125+
document.querySelector('.binddnrequired')?.classList.remove('required');
126126

127127
const authType = this.value;
128128
switch (authType) {
@@ -131,7 +131,7 @@ export function initAdminCommon() {
131131
for (const input of document.querySelectorAll('.binddnrequired input, .ldap div.required:not(.dldap) input')) {
132132
input.setAttribute('required', 'required');
133133
}
134-
$('.binddnrequired').addClass('required');
134+
document.querySelector('.binddnrequired')?.classList.add('required');
135135
break;
136136
case '3': // SMTP
137137
showElem('.smtp');
@@ -234,16 +234,15 @@ export function initAdminCommon() {
234234
});
235235
document.getElementById('delete-selection')?.addEventListener('click', async function (e) {
236236
e.preventDefault();
237-
const $this = $(this);
238-
$this.addClass('is-loading disabled');
237+
this.classList.add('is-loading', 'disabled');
239238
const data = new FormData();
240239
$checkboxes.each(function () {
241240
if ($(this).checkbox('is checked')) {
242-
data.append('ids[]', $(this).data('id'));
241+
data.append('ids[]', this.getAttribute('data-id'));
243242
}
244243
});
245-
await POST($this.data('link'), {data});
246-
window.location.href = $this.data('redirect');
244+
await POST(this.getAttribute('data-link'), {data});
245+
window.location.href = this.getAttribute('data-redirect');
247246
});
248247
}
249248
}

0 commit comments

Comments
 (0)