summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-06-06 16:45:23 -0500
committerMike Greiling <mike@pixelcog.com>2018-06-06 17:06:21 -0500
commit0cb4bb1af8fb5b5c71a9b547114563ccec355979 (patch)
tree3822ad36786dc4acecb5743f7fc5d4913149ac09
parentaf261c1b314058c3aefef3377b9f7f8a20701481 (diff)
downloadgitlab-ce-0cb4bb1af8fb5b5c71a9b547114563ccec355979.tar.gz
rely on presense or absense of data attribute instead of coerced boolean strings
-rw-r--r--app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js11
-rw-r--r--app/views/projects/settings/ci_cd/_autodevops_form.html.haml6
2 files changed, 9 insertions, 8 deletions
diff --git a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
index 152f76ff7af..37ef77c8e43 100644
--- a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
+++ b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
@@ -28,11 +28,12 @@ document.addEventListener('DOMContentLoaded', () => {
const autoDevOpsExtraSettings = document.querySelector('.js-extra-settings');
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');
+ const target = event.target;
+ if (target.classList.contains('js-toggle-extra-settings')) {
+ autoDevOpsExtraSettings.classList.toggle(
+ 'hidden',
+ !!(target.dataset && target.dataset.hideExtraSettings),
+ );
}
});
});
diff --git a/app/views/projects/settings/ci_cd/_autodevops_form.html.haml b/app/views/projects/settings/ci_cd/_autodevops_form.html.haml
index c3e10a93456..4359362bb05 100644
--- a/app/views/projects/settings/ci_cd/_autodevops_form.html.haml
+++ b/app/views/projects/settings/ci_cd/_autodevops_form.html.haml
@@ -13,7 +13,7 @@
.card.auto-devops-card
.card-body
.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
%strong= s_('CICD|Enable Auto DevOps')
.form-text.text-muted
@@ -22,7 +22,7 @@
.card.auto-devops-card
.card-body
.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
%strong= s_('CICD|Instance default (%{state})') % { state: "#{Gitlab::CurrentSettings.auto_devops_enabled? ? _('enabled') : _('disabled')}" }
.form-text.text-muted
@@ -57,7 +57,7 @@
.card.auto-devops-card
.card-body
.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
%strong= s_('CICD|Disable Auto DevOps')
.form-text.text-muted