diff options
author | Jack Davison <jack.davison@student.manchester.ac.uk> | 2016-07-18 21:10:28 +0100 |
---|---|---|
committer | Jack Davison <jack.davison@student.manchester.ac.uk> | 2016-08-17 21:25:40 +0100 |
commit | d548f3ee27fd12b4bafd36b0d6f2b9890ac383b4 (patch) | |
tree | 8ccd8f2db5157eedef3474168e23fffe01b12012 /app/assets | |
parent | 9250953af7b3c781101fb982969ba4522fb87b30 (diff) | |
download | gitlab-ce-d548f3ee27fd12b4bafd36b0d6f2b9890ac383b4.tar.gz |
Replace resetTooltip with bootstrap's fixTitle
* resetTooltip totally destroyed and regenerated the
tooltip while fixTitle simply replaces the text in
the existing element.
* resetTooltip also called an asyncronous function
with no suitable callback resulting in a messy
setTimout workaround. fixTitle is syncronous.
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 6cde99127b5..aee1c29eee3 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -220,13 +220,13 @@ originalTitle = this.getAwardTooltip(awardBlock); authors = originalTitle.split(FROM_SENTENCE_REGEX); authors.splice(authors.indexOf('You'), 1); - awardBlock + return awardBlock .closest('.js-emoji-btn') .removeData('title') .removeAttr('data-title') .removeAttr('data-original-title') - .attr('title', this.toSentence(authors)); - return this.resetTooltip(awardBlock); + .attr('title', this.toSentence(authors)) + .tooltip('fixTitle'); }; AwardsHandler.prototype.addYouToUserList = function(votesBlock, emoji) { @@ -238,17 +238,9 @@ users = origTitle.trim().split(FROM_SENTENCE_REGEX); } users.unshift('You'); - awardBlock.attr('title', this.toSentence(users)); - return this.resetTooltip(awardBlock); - }; - - AwardsHandler.prototype.resetTooltip = function(award) { - var cb; - award.tooltip('destroy'); - cb = function() { - return award.tooltip(); - }; - return setTimeout(cb, 200); + return awardBlock + .attr('title', this.toSentence(users)) + .tooltip('fixTitle'); }; AwardsHandler.prototype.createEmoji_ = function(votesBlock, emoji) { |