new options
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
$('#forward_for_check'),
|
||||
$('#add_acl_path'),
|
||||
$('#add_path_based'),
|
||||
$('#add_custom_acl'),
|
||||
];
|
||||
|
||||
const forbiddenFields = $('#forbidden_fields');
|
||||
@@ -47,22 +48,6 @@
|
||||
protocolSelect?.addEventListener('change', onProtocolChange);
|
||||
onProtocolChange();
|
||||
|
||||
// ===== ACL FIELDS =====
|
||||
const aclCheckbox = $('#add_acl');
|
||||
const aclFields = $('#acl_fields');
|
||||
aclCheckbox?.addEventListener('change', () => toggle(aclCheckbox.checked, aclFields));
|
||||
|
||||
// ===== GENERIC TOGGLE BINDER =====
|
||||
const bindToggle = (checkboxSel, targetSel) => {
|
||||
const cb = $(checkboxSel);
|
||||
const target = $(targetSel);
|
||||
cb?.addEventListener('change', () => toggle(cb.checked, target));
|
||||
if (cb && target) toggle(cb.checked, target);
|
||||
};
|
||||
|
||||
bindToggle('#add_path_based', '#base_redirect_fields');
|
||||
bindToggle('#add_acl_path', '#forbidden_fields');
|
||||
|
||||
// ===== BACKEND SSL REDIRECT =====
|
||||
const backendSslCheckbox = $('#backend_ssl_redirect');
|
||||
const backendSslFields = $('#backend_ssl_fields');
|
||||
@@ -71,4 +56,27 @@
|
||||
toggle(this.checked, backendSslFields);
|
||||
});
|
||||
|
||||
// ===== CUSTOM ACL (Main Toggle) =====
|
||||
const customAclCheckbox = $('#add_custom_acl');
|
||||
const customAclFields = $('#custom_acl_fields');
|
||||
|
||||
customAclCheckbox?.addEventListener('change', function() {
|
||||
toggle(this.checked, customAclFields);
|
||||
});
|
||||
|
||||
// ===== CUSTOM ACL Action Type Toggle =====
|
||||
const customAclAction = $('#custom_acl_action');
|
||||
const aclBackendSelect = $('#acl_backend_select');
|
||||
const aclRedirectSelect = $('#acl_redirect_select');
|
||||
|
||||
const onCustomAclActionChange = () => {
|
||||
const action = customAclAction?.value;
|
||||
toggle(action === 'route', aclBackendSelect);
|
||||
toggle(action === 'redirect', aclRedirectSelect);
|
||||
};
|
||||
|
||||
customAclAction?.addEventListener('change', onCustomAclActionChange);
|
||||
// Initial state
|
||||
onCustomAclActionChange();
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user