diff options
Diffstat (limited to 'app/assets/javascripts/toggle_buttons.js')
-rw-r--r-- | app/assets/javascripts/toggle_buttons.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/assets/javascripts/toggle_buttons.js b/app/assets/javascripts/toggle_buttons.js index 974dc3ee052..199b14458ed 100644 --- a/app/assets/javascripts/toggle_buttons.js +++ b/app/assets/javascripts/toggle_buttons.js @@ -8,12 +8,12 @@ import { convertPermissionToBoolean } from './lib/utils/common_utils'; ``` %button.js-project-feature-toggle.project-feature-toggle{ type: "button", class: "#{'is-checked' if enabled?}", - 'aria-label': _('Toggle Cluster') } + 'aria-label': _('Toggle Kubernetes Cluster') } %input{ type: "hidden", class: 'js-project-feature-toggle-input', value: enabled? } ``` */ -function updatetoggle(toggle, isOn) { +function updateToggle(toggle, isOn) { toggle.classList.toggle('is-checked', isOn); } @@ -21,7 +21,7 @@ function onToggleClicked(toggle, input, clickCallback) { const previousIsOn = convertPermissionToBoolean(input.value); // Visually change the toggle and start loading - updatetoggle(toggle, !previousIsOn); + updateToggle(toggle, !previousIsOn); toggle.setAttribute('disabled', true); toggle.classList.toggle('is-loading', true); @@ -32,7 +32,7 @@ function onToggleClicked(toggle, input, clickCallback) { }) .catch(() => { // Revert the visuals if something goes wrong - updatetoggle(toggle, previousIsOn); + updateToggle(toggle, previousIsOn); }) .then(() => { // Remove the loading indicator in any case @@ -54,7 +54,7 @@ export default function setupToggleButtons(container, clickCallback = () => {}) const isOn = convertPermissionToBoolean(input.value); // Get the visible toggle in sync with the hidden input - updatetoggle(toggle, isOn); + updateToggle(toggle, isOn); toggle.addEventListener('click', onToggleClicked.bind(null, toggle, input, clickCallback)); }); |