From 1bde1985c22c947a28d4da8d237f5ea8b894c2e0 Mon Sep 17 00:00:00 2001 From: Luke Howell Date: Sat, 10 Sep 2016 14:14:24 -0500 Subject: [PATCH] Fix tooltip for Copy to clipboard button. Fix "Copy to clipboard" tooltip to say "Copied!" when clipboard button is clicked. Closes #22022 --- CHANGELOG | 1 + app/assets/javascripts/copy_to_clipboard.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b4368c2cf9e..e4f39c27f40 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,6 +22,7 @@ v 8.13.0 (unreleased) - Fix broken repository 500 errors in project list v 8.12.4 (unreleased) + - Fix "Copy to clipboard" tooltip to say "Copied!" when clipboard button is clicked. (lukehowell) v 8.12.3 - Update Gitlab Shell to support low IO priority for storage moves diff --git a/app/assets/javascripts/copy_to_clipboard.js b/app/assets/javascripts/copy_to_clipboard.js index 3e20db7e308..e23bda2fa4e 100644 --- a/app/assets/javascripts/copy_to_clipboard.js +++ b/app/assets/javascripts/copy_to_clipboard.js @@ -26,15 +26,15 @@ }; showTooltip = function(target, title) { - return $(target).tooltip({ - container: 'body', - html: 'true', - placement: 'auto bottom', - title: title, - trigger: 'manual' - }).tooltip('show').one('mouseleave', function() { - return $(this).tooltip('hide'); - }); + var $target = $(target); + var originalTitle = $target.data('original-title'); + + $target + .attr('title', 'Copied!') + .tooltip('fixTitle') + .tooltip('show') + .attr('title', originalTitle) + .tooltip('fixTitle'); }; $(function() {