gitea/web_src/js/features/require-actions-select.js
Alex Lau(AvengerMoJo) 3b8177f096
Combined all RequestActions implementation and merge upstream
Update all formating issues

Signed-off-by: Alex Lau(AvengerMoJo) <avengermojo@gmail.com>
2024-08-23 17:53:41 +08:00

20 lines
716 B
JavaScript

export function initRequireActionsSelect() {
const raselect = document.querySelector('add-require-actions-modal');
if (!raselect) return;
const checkboxes = document.querySelectorAll('.ui.radio.checkbox');
for (const box of checkboxes) {
box.addEventListener('change', function() {
const hiddenInput = this.nextElementSibling;
const isChecked = this.querySelector('input[type="radio"]').checked;
hiddenInput.disabled = !isChecked;
// Disable other hidden inputs
for (const otherbox of checkboxes) {
const otherHiddenInput = otherbox.nextElementSibling;
if (otherbox !== box) {
otherHiddenInput.disabled = isChecked;
}
}
});
}
}