diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 23:02:30 +0300 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /app/assets/javascripts/toggles/index.js | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'app/assets/javascripts/toggles/index.js')
-rw-r--r-- | app/assets/javascripts/toggles/index.js | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/app/assets/javascripts/toggles/index.js b/app/assets/javascripts/toggles/index.js index 046b9fc7dcd..5848b3a424c 100644 --- a/app/assets/javascripts/toggles/index.js +++ b/app/assets/javascripts/toggles/index.js @@ -8,16 +8,12 @@ export const initToggle = (el) => { return false; } - const { - name, - isChecked, - disabled, - isLoading, - label, - help, - labelPosition, - ...dataset - } = el.dataset; + const { name, id, isChecked, disabled, isLoading, label, help, labelPosition, ...dataset } = + el.dataset || {}; + + const dataAttrs = Object.fromEntries( + Object.entries(dataset).map(([key, value]) => [`data-${kebabCase(key)}`, value]), + ); return new Vue({ el, @@ -50,9 +46,7 @@ export const initToggle = (el) => { labelPosition, }, class: el.className, - attrs: Object.fromEntries( - Object.entries(dataset).map(([key, value]) => [`data-${kebabCase(key)}`, value]), - ), + attrs: { id, ...dataAttrs }, on: { change: (newValue) => { this.value = newValue; |