Commit c697c960 authored by Fatih Acet's avatar Fatih Acet

Fix award tooltip after voting.

parent 1d7c3c79
...@@ -156,26 +156,46 @@ class @AwardsHandler ...@@ -156,26 +156,46 @@ class @AwardsHandler
$emojiBtn.removeClass("active") $emojiBtn.removeClass("active")
getAwardTooltip: ($awardBlock) ->
return $awardBlock.attr('data-original-title') or $awardBlock.attr('data-title')
removeMeFromUserList: ($emojiBtn, emoji) -> removeMeFromUserList: ($emojiBtn, emoji) ->
award_block = $emojiBtn
authors = award_block awardBlock = $emojiBtn
.attr("data-original-title") originalTitle = @getAwardTooltip awardBlock
.split(", ")
authors.splice(authors.indexOf("me"),1) authors = originalTitle.split ', '
award_block authors.splice authors.indexOf('me'), 1
.closest(".js-emoji-btn")
.attr("data-original-title", authors.join(", ")) newAuthors = authors.join ', '
@resetTooltip(award_block)
awardBlock
.closest '.js-emoji-btn'
.removeData 'original-title'
.removeData 'title'
.attr 'data-original-title', newAuthors
.attr 'data-title', newAuthors
@resetTooltip(awardBlock)
addMeToUserList: (emoji) -> addMeToUserList: (emoji) ->
award_block = @findEmojiIcon(emoji).parent()
origTitle = award_block.attr("data-original-title").trim() awardBlock = @findEmojiIcon(emoji).parent()
users = [] origTitle = @getAwardTooltip awardBlock
users = []
if origTitle if origTitle
users = origTitle.split(', ') users = origTitle.trim().split(', ')
users.push("me")
award_block.attr("title", users.join(", ")) users.push('me')
@resetTooltip(award_block) awardBlock.attr('title', users.join(", "))
@resetTooltip(awardBlock)
resetTooltip: (award) -> resetTooltip: (award) ->
award.tooltip("destroy") award.tooltip("destroy")
......
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