diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-06-15 15:14:53 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-06-15 15:14:53 +0300 |
commit | 13b32e74bcd379eae0422dd971a196d07fa2c5fe (patch) | |
tree | 9024b75b6a968a0ce4625a83ef6940e322159ec6 /app/assets | |
parent | d8b399a8c6051a3bdef56e8d7c63ac1d40ddc071 (diff) |
Fix project star tooltip on the fly.
Introduced new util called updateTooltipTitle.
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/lib/common_utils.js.coffee | 12 | ||||
-rw-r--r-- | app/assets/javascripts/star.js.coffee | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/common_utils.js.coffee b/app/assets/javascripts/lib/common_utils.js.coffee index 0000e99a650..5e3a802f45f 100644 --- a/app/assets/javascripts/lib/common_utils.js.coffee +++ b/app/assets/javascripts/lib/common_utils.js.coffee @@ -1,5 +1,8 @@ ((w) -> + window.gl or= {} + window.gl.utils or= {} + jQuery.timefor = (time, suffix, expiredLabel) -> return '' unless time @@ -21,4 +24,13 @@ return timefor + + gl.utils.updateTooltipTitle = ($tooltipEl, newTitle) -> + + $tooltipEl + .tooltip 'destroy' + .attr 'title', newTitle + .tooltip 'fixTitle' + + ) window diff --git a/app/assets/javascripts/star.js.coffee b/app/assets/javascripts/star.js.coffee index f27780dda93..01b28171f72 100644 --- a/app/assets/javascripts/star.js.coffee +++ b/app/assets/javascripts/star.js.coffee @@ -9,9 +9,11 @@ class @Star $this.parent().find('.star-count').text data.star_count if isStarred $starSpan.removeClass('starred').text 'Star' + gl.utils.updateTooltipTitle $this, 'Star project' $starIcon.removeClass('fa-star').addClass 'fa-star-o' else $starSpan.addClass('starred').text 'Unstar' + gl.utils.updateTooltipTitle $this, 'Unstar project' $starIcon.removeClass('fa-star-o').addClass 'fa-star' return |