Commit af261c1b authored by Mike Greiling's avatar Mike Greiling

attach a single event handler to detect radio button changes instead of one per input

parent ff582303
......@@ -24,15 +24,15 @@ document.addEventListener('DOMContentLoaded', () => {
});
// hide extra auto devops settings based on data-attributes
const autoDevOpsSettings = document.querySelectorAll('input[data-hide-extra-settings]');
const autoDevOpsSettings = document.querySelector('.js-auto-devops-settings');
const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings');
autoDevOpsSettings.forEach(input => {
input.addEventListener('click', () =>
autoDevOpsExtraSettings.classList.toggle(
'hidden',
input.dataset.hideExtraSettings === 'true',
),
);
autoDevOpsSettings.addEventListener('click', event => {
const targetData = event.target && event.target.dataset;
if (targetData.hideExtraSettings === 'true') {
autoDevOpsExtraSettings.classList.add('hidden');
} else if (targetData.hideExtraSettings === 'false') {
autoDevOpsExtraSettings.classList.remove('hidden');
}
});
});
......@@ -2,7 +2,7 @@
.col-lg-12
= form_for @project, url: project_settings_ci_cd_path(@project) do |f|
= form_errors(@project)
%fieldset.builds-feature.auto-devops-settings
%fieldset.builds-feature.js-auto-devops-settings
.form-group
- message = auto_devops_warning_message(@project)
- ci_file_formatted = '<code>.gitlab-ci.yml</code>'.html_safe
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment