Commit 10c23742 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch...

Merge branch '249779-replace-bstooltip-with-gltooltip-in-app-assets-javascripts-behaviors-copy_to_clipboard-js' into 'master'

Replace tooltip api calls with facade calls in copy_to_clipboard.js

See merge request gitlab-org/gitlab!45035
parents 5fbe7b8b 27be863f
import $ from 'jquery';
import Clipboard from 'clipboard';
import { sprintf, __ } from '~/locale';
import { fixTitle, show } from '~/tooltips';
function showTooltip(target, title) {
const $target = $(target);
const originalTitle = $target.data('originalTitle');
const { originalTitle } = target.dataset;
const hideTooltip = () => {
target.removeEventListener('mouseout', hideTooltip);
setTimeout(() => {
target.setAttribute('title', originalTitle);
fixTitle(target);
}, 300);
};
if (!$target.data('hideTooltip')) {
$target
.attr('title', title)
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', originalTitle)
.tooltip('_fixTitle');
}
target.setAttribute('title', title);
fixTitle(target);
show(target);
target.addEventListener('mouseout', hideTooltip);
}
function genericSuccess(e) {
......
import Vue from 'vue';
import jQuery from 'jquery';
import { toArray, isFunction } from 'lodash';
import { toArray, isFunction, isElement } from 'lodash';
import Tooltips from './components/tooltips.vue';
let app;
......@@ -54,7 +54,11 @@ const handleTooltipEvent = (rootTarget, e, selector, config = {}) => {
}
};
const applyToElements = (elements, handler) => toArray(elements).forEach(handler);
const applyToElements = (elements, handler) => {
const iterable = isElement(elements) ? [elements] : toArray(elements);
toArray(iterable).forEach(handler);
};
const invokeBootstrapApi = (elements, method) => {
if (isFunction(elements.tooltip)) {
......
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