sharing: Drop jQuery code as the library dependency has been removed

Tests:

- Enabling/disabling public share shows and hides the list of groups in share
edit page.

- When loading the share page, if public share is enabled, list of groups is
hidden.

- When loading the share page, if public share is disabled, list of groups is
shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-01-04 11:34:19 -08:00 committed by James Valleroy
parent 5fc48e684b
commit 79482f7a38
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -22,16 +22,19 @@
* in this page.
*/
var sharing_groups = $('#id_sharing-groups').parent().parent();
document.addEventListener('DOMContentLoaded', () => {
const sharingGroups = document.getElementById('id_sharing-groups').closest('.form-group');
const isPublic = document.getElementById('id_sharing-is_public');
if ($("#id_sharing-is_public").prop('checked')) {
sharing_groups.hide();
}
$("#id_sharing-is_public").change(function() {
if (this.checked) {
sharing_groups.hide();
} else {
sharing_groups.show();
if (isPublic.checked) {
sharingGroups.style.display = 'none';
}
isPublic.addEventListener('change', (event) => {
if (event.currentTarget.checked) {
sharingGroups.style.display = 'none';
} else {
sharingGroups.style.display = '';
}
});
});