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', () => { ...@@ -24,15 +24,15 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
// hide extra auto devops settings based on data-attributes // 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'); const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings');
autoDevOpsSettings.forEach(input => { autoDevOpsSettings.addEventListener('click', event => {
input.addEventListener('click', () => const targetData = event.target && event.target.dataset;
autoDevOpsExtraSettings.classList.toggle( if (targetData.hideExtraSettings === 'true') {
'hidden', autoDevOpsExtraSettings.classList.add('hidden');
input.dataset.hideExtraSettings === 'true', } else if (targetData.hideExtraSettings === 'false') {
), autoDevOpsExtraSettings.classList.remove('hidden');
); }
}); });
}); });
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.col-lg-12 .col-lg-12
= form_for @project, url: project_settings_ci_cd_path(@project) do |f| = form_for @project, url: project_settings_ci_cd_path(@project) do |f|
= form_errors(@project) = form_errors(@project)
%fieldset.builds-feature.auto-devops-settings %fieldset.builds-feature.js-auto-devops-settings
.form-group .form-group
- message = auto_devops_warning_message(@project) - message = auto_devops_warning_message(@project)
- ci_file_formatted = '<code>.gitlab-ci.yml</code>'.html_safe - 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