Commit f009edbb authored by Enrique Alcantara's avatar Enrique Alcantara

Replace BS Tooltips with tooltips facade

Replace all jQuery tooltip API calls with the
tooltips facade API
parent 63a28a1e
...@@ -39,6 +39,8 @@ import initPersistentUserCallouts from './persistent_user_callouts'; ...@@ -39,6 +39,8 @@ import initPersistentUserCallouts from './persistent_user_callouts';
import { initUserTracking, initDefaultTrackers } from './tracking'; import { initUserTracking, initDefaultTrackers } from './tracking';
import { __ } from './locale'; import { __ } from './locale';
import * as tooltips from '~/tooltips';
import 'ee_else_ce/main_ee'; import 'ee_else_ce/main_ee';
applyGitLabUIConfig(); applyGitLabUIConfig();
...@@ -77,7 +79,7 @@ document.addEventListener('beforeunload', () => { ...@@ -77,7 +79,7 @@ document.addEventListener('beforeunload', () => {
// Unbind scroll events // Unbind scroll events
$(document).off('scroll'); $(document).off('scroll');
// Close any open tooltips // Close any open tooltips
$('.has-tooltip, [data-toggle="tooltip"]').tooltip('dispose'); tooltips.dispose(document.querySelectorAll('.has-tooltip, [data-toggle="tooltip"]'));
// Close any open popover // Close any open popover
$('[data-toggle="popover"]').popover('dispose'); $('[data-toggle="popover"]').popover('dispose');
}); });
...@@ -133,8 +135,10 @@ function deferredInitialisation() { ...@@ -133,8 +135,10 @@ function deferredInitialisation() {
addSelectOnFocusBehaviour('.js-select-on-focus'); addSelectOnFocusBehaviour('.js-select-on-focus');
$('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() { $('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() {
tooltips.dispose(this);
// eslint-disable-next-line no-jquery/no-fade
$(this) $(this)
.tooltip('dispose')
.closest('li') .closest('li')
.fadeOut(); .fadeOut();
}); });
...@@ -154,7 +158,7 @@ function deferredInitialisation() { ...@@ -154,7 +158,7 @@ function deferredInitialisation() {
const delay = glTooltipDelay ? JSON.parse(glTooltipDelay) : 0; const delay = glTooltipDelay ? JSON.parse(glTooltipDelay) : 0;
// Initialize tooltips // Initialize tooltips
$body.tooltip({ tooltips.initTooltips({
selector: '.has-tooltip, [data-toggle="tooltip"]', selector: '.has-tooltip, [data-toggle="tooltip"]',
trigger: 'hover', trigger: 'hover',
boundary: 'viewport', boundary: 'viewport',
......
...@@ -58,6 +58,8 @@ const applyToElements = (elements, handler) => toArray(elements).forEach(handler ...@@ -58,6 +58,8 @@ const applyToElements = (elements, handler) => toArray(elements).forEach(handler
const invokeBootstrapApi = (elements, method) => { const invokeBootstrapApi = (elements, method) => {
if (isFunction(elements.tooltip)) { if (isFunction(elements.tooltip)) {
elements.tooltip(method);
} else {
jQuery(elements).tooltip(method); jQuery(elements).tooltip(method);
} }
}; };
......
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