Commit 705d7f70 authored by Clement Ho's avatar Clement Ho

[skip ci] Use toggleClass instead of toggle

parent b8401cd0
...@@ -33,12 +33,12 @@ export default class SecretValues { ...@@ -33,12 +33,12 @@ export default class SecretValues {
updateDom(isRevealed) { updateDom(isRevealed) {
const values = this.container.querySelectorAll(this.valueSelector); const values = this.container.querySelectorAll(this.valueSelector);
values.forEach((value) => { values.forEach((value) => {
value.classList.toggle('hide', !isRevealed); value.classList.toggle('hidden', !isRevealed);
}); });
const placeholders = this.container.querySelectorAll(this.placeholderSelector); const placeholders = this.container.querySelectorAll(this.placeholderSelector);
placeholders.forEach((placeholder) => { placeholders.forEach((placeholder) => {
placeholder.classList.toggle('hide', isRevealed); placeholder.classList.toggle('hidden', isRevealed);
}); });
this.revealButton.textContent = isRevealed ? n__('Hide value', 'Hide values', values.length) : n__('Reveal value', 'Reveal values', values.length); this.revealButton.textContent = isRevealed ? n__('Hide value', 'Hide values', values.length) : n__('Reveal value', 'Reveal values', values.length);
......
...@@ -20,7 +20,7 @@ $(() => { ...@@ -20,7 +20,7 @@ $(() => {
$container $container
.find('.js-toggle-content') .find('.js-toggle-content')
.toggle(toggleState); .toggleClass('hidden', toggleState);
} }
$('body').on('click', '.js-toggle-button', function toggleButton(e) { $('body').on('click', '.js-toggle-button', function toggleButton(e) {
......
...@@ -4,7 +4,7 @@ export default function handleRevealVariables() { ...@@ -4,7 +4,7 @@ export default function handleRevealVariables() {
$('.js-reveal-variables') $('.js-reveal-variables')
.off('click') .off('click')
.on('click', function click() { .on('click', function click() {
$('.js-build-variables').toggle(); $('.js-build-variables').toggleClass('hidden');
$(this).hide(); $(this).hide();
}); });
} }
...@@ -52,8 +52,8 @@ export default class AjaxVariableList { ...@@ -52,8 +52,8 @@ export default class AjaxVariableList {
onSaveClicked() { onSaveClicked() {
const loadingIcon = this.saveButton.querySelector('.js-secret-variables-save-loading-icon'); const loadingIcon = this.saveButton.querySelector('.js-secret-variables-save-loading-icon');
loadingIcon.classList.toggle('hide', false); loadingIcon.classList.toggle('hidden', false);
this.errorBox.classList.toggle('hide', true); this.errorBox.classList.toggle('hidden', true);
// We use this to prevent a user from changing a key before we have a chance // We use this to prevent a user from changing a key before we have a chance
// to match it up in `updateRowsWithPersistedVariables` // to match it up in `updateRowsWithPersistedVariables`
this.variableList.toggleEnableRow(false); this.variableList.toggleEnableRow(false);
...@@ -70,7 +70,7 @@ export default class AjaxVariableList { ...@@ -70,7 +70,7 @@ export default class AjaxVariableList {
status === statusCodes.BAD_REQUEST, status === statusCodes.BAD_REQUEST,
}) })
.then((res) => { .then((res) => {
loadingIcon.classList.toggle('hide', true); loadingIcon.classList.toggle('hidden', true);
this.variableList.toggleEnableRow(true); this.variableList.toggleEnableRow(true);
if (res.status === statusCodes.OK && res.data) { if (res.status === statusCodes.OK && res.data) {
...@@ -79,11 +79,11 @@ export default class AjaxVariableList { ...@@ -79,11 +79,11 @@ export default class AjaxVariableList {
} else if (res.status === statusCodes.BAD_REQUEST) { } else if (res.status === statusCodes.BAD_REQUEST) {
// Validation failed // Validation failed
this.errorBox.innerHTML = generateErrorBoxContent(res.data); this.errorBox.innerHTML = generateErrorBoxContent(res.data);
this.errorBox.classList.toggle('hide', false); this.errorBox.classList.toggle('hidden', false);
} }
}) })
.catch(() => { .catch(() => {
loadingIcon.classList.toggle('hide', true); loadingIcon.classList.toggle('hidden', true);
this.variableList.toggleEnableRow(true); this.variableList.toggleEnableRow(true);
Flash(s__('CiVariable|Error occured while saving variables')); Flash(s__('CiVariable|Error occured while saving variables'));
}); });
......
...@@ -367,7 +367,7 @@ export default class MergeRequestTabs { ...@@ -367,7 +367,7 @@ export default class MergeRequestTabs {
// //
// status - Boolean, true to show, false to hide // status - Boolean, true to show, false to hide
toggleLoading(status) { toggleLoading(status) {
$('.mr-loading-status .loading').toggle(status); $('.mr-loading-status .loading').toggleClass('hidden', status);
} }
diffViewType() { diffViewType() {
......
...@@ -1229,8 +1229,8 @@ export default class Notes { ...@@ -1229,8 +1229,8 @@ export default class Notes {
const isForced = forceShow === true || forceShow === false; const isForced = forceShow === true || forceShow === false;
const showNow = forceShow === true || (!isCurrentlyShown && !isForced); const showNow = forceShow === true || (!isCurrentlyShown && !isForced);
targetRow.toggle(showNow); targetRow.toggleClass('hidden', showNow);
notesContent.toggle(showNow); notesContent.toggleClass('hidden', showNow);
} }
if (addForm) { if (addForm) {
......
...@@ -25,7 +25,7 @@ export default function adminInit() { ...@@ -25,7 +25,7 @@ export default function adminInit() {
$('body').on('click', '.js-toggle-colors-link', (e) => { $('body').on('click', '.js-toggle-colors-link', (e) => {
e.preventDefault(); e.preventDefault();
$('.js-toggle-colors-container').toggle(); $('.js-toggle-colors-container').toggleClass('hidden');
}); });
$('.log-tabs a').on('click', function logTabsClick(e) { $('.log-tabs a').on('click', function logTabsClick(e) {
......
...@@ -12,5 +12,5 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -12,5 +12,5 @@ document.addEventListener('DOMContentLoaded', () => {
landingElement.querySelector('.dismiss-button'), landingElement.querySelector('.dismiss-button'),
'explore_groups_landing_dismissed', 'explore_groups_landing_dismissed',
); );
exploreGroupsLanding.toggle(); exploreGroupsLanding.toggleClass('hidden');
}); });
...@@ -181,7 +181,7 @@ export default class UserTabs { ...@@ -181,7 +181,7 @@ export default class UserTabs {
toggleLoading(status) { toggleLoading(status) {
return this.$parentEl.find('.loading-status .loading') return this.$parentEl.find('.loading-status .loading')
.toggle(status); .toggleClass('hidden', status);
} }
setCurrentAction(source) { setCurrentAction(source) {
......
...@@ -4,6 +4,6 @@ export default () => { ...@@ -4,6 +4,6 @@ export default () => {
$('.js-fork-thumbnail').on('click', function forkThumbnailClicked() { $('.js-fork-thumbnail').on('click', function forkThumbnailClicked() {
if ($(this).hasClass('disabled')) return false; if ($(this).hasClass('disabled')) return false;
return $('.js-fork-content').toggle(); return $('.js-fork-content').toggleClass('hidden');
}); });
}; };
...@@ -56,7 +56,7 @@ module IconsHelper ...@@ -56,7 +56,7 @@ module IconsHelper
def spinner(text = nil, visible = false) def spinner(text = nil, visible = false)
css_class = 'loading' css_class = 'loading'
css_class << ' hide' unless visible css_class << ' hidden' unless visible
content_tag :div, class: css_class do content_tag :div, class: css_class do
icon('spinner spin') + text icon('spinner spin') + text
......
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