Commit 0cb4bb1a authored by Mike Greiling's avatar Mike Greiling

rely on presense or absense of data attribute instead of coerced boolean strings

parent af261c1b
...@@ -28,11 +28,12 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -28,11 +28,12 @@ document.addEventListener('DOMContentLoaded', () => {
const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings'); const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings');
autoDevOpsSettings.addEventListener('click', event => { autoDevOpsSettings.addEventListener('click', event => {
const targetData = event.target && event.target.dataset; const target = event.target;
if (targetData.hideExtraSettings === 'true') { if (target.classList.contains('js-toggle-extra-settings')) {
autoDevOpsExtraSettings.classList.add('hidden'); autoDevOpsExtraSettings.classList.toggle(
} else if (targetData.hideExtraSettings === 'false') { 'hidden',
autoDevOpsExtraSettings.classList.remove('hidden'); !!(target.dataset && target.dataset.hideExtraSettings),
);
} }
}); });
}); });
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
.card.auto-devops-card .card.auto-devops-card
.card-body .card-body
.form-check .form-check
= form.radio_button :enabled, 'true', class: 'form-check-input', data: { hide_extra_settings: false } = form.radio_button :enabled, 'true', class: 'form-check-input js-toggle-extra-settings'
= form.label :enabled_true, class: 'form-check-label' do = form.label :enabled_true, class: 'form-check-label' do
%strong= s_('CICD|Enable Auto DevOps') %strong= s_('CICD|Enable Auto DevOps')
.form-text.text-muted .form-text.text-muted
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
.card.auto-devops-card .card.auto-devops-card
.card-body .card-body
.form-check .form-check
= form.radio_button :enabled, '', class: 'form-check-input', data: { hide_extra_settings: false } = form.radio_button :enabled, '', class: 'form-check-input js-toggle-extra-settings'
= form.label :enabled_, class: 'form-check-label' do = form.label :enabled_, class: 'form-check-label' do
%strong= s_('CICD|Instance default (%{state})') % { state: "#{Gitlab::CurrentSettings.auto_devops_enabled? ? _('enabled') : _('disabled')}" } %strong= s_('CICD|Instance default (%{state})') % { state: "#{Gitlab::CurrentSettings.auto_devops_enabled? ? _('enabled') : _('disabled')}" }
.form-text.text-muted .form-text.text-muted
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
.card.auto-devops-card .card.auto-devops-card
.card-body .card-body
.form-check .form-check
= form.radio_button :enabled, 'false', class: 'form-check-input', data: { hide_extra_settings: true } = form.radio_button :enabled, 'false', class: 'form-check-input js-toggle-extra-settings', data: { hide_extra_settings: true }
= form.label :enabled_false, class: 'form-check-label' do = form.label :enabled_false, class: 'form-check-label' do
%strong= s_('CICD|Disable Auto DevOps') %strong= s_('CICD|Disable Auto DevOps')
.form-text.text-muted .form-text.text-muted
......
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