Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-05-30 20:04:08 +0300
committerZ.J. van de Weg <zegerjan@gitlab.com>2016-06-06 12:10:10 +0300
commit63a5402182aa9697bbd9e2d7192ef661c6d74b86 (patch)
tree1af30642439eb5995036064b8f0a357fa141a389 /app/assets/javascripts/awards_handler.coffee
parentf1d74ccc8ca8e3fa91e87193fc886e9a00a636b3 (diff)
Create and show emoji loader on the fly.
Diffstat (limited to 'app/assets/javascripts/awards_handler.coffee')
-rw-r--r--app/assets/javascripts/awards_handler.coffee24
1 files changed, 19 insertions, 5 deletions
diff --git a/app/assets/javascripts/awards_handler.coffee b/app/assets/javascripts/awards_handler.coffee
index 8a6f6d7d185..e01c5d68c43 100644
--- a/app/assets/javascripts/awards_handler.coffee
+++ b/app/assets/javascripts/awards_handler.coffee
@@ -100,12 +100,13 @@ class @AwardsHandler
$menu.css(css)
- addAward: (votesBlock, awardUrl, emoji, checkMutuality = yes) ->
+ addAward: (votesBlock, awardUrl, emoji, checkMutuality = yes, callback) ->
emoji = @normilizeEmojiName emoji
@postEmoji awardUrl, emoji, =>
@addAwardToEmojiBar votesBlock, emoji, checkMutuality
+ callback?()
$('.emoji-menu').removeClass 'is-visible'
@@ -146,11 +147,24 @@ class @AwardsHandler
awardUrl = @getAwardUrl()
if emoji in [ 'thumbsup', 'thumbsdown' ]
- mutualVote = if emoji is 'thumbsup' then 'thumbsdown' else 'thumbsup'
- selector = "[data-emoji=#{mutualVote}]"
+ mutualVote = if emoji is 'thumbsup' then 'thumbsdown' else 'thumbsup'
+ $emojiButton = votesBlock.find("[data-emoji=#{mutualVote}]").parent()
+ isAlreadyVoted = $emojiButton.hasClass 'active'
- isAlreadyVoted = votesBlock.find(selector).parent().hasClass 'active'
- @addAward votesBlock, awardUrl, mutualVote, no if isAlreadyVoted
+ if isAlreadyVoted
+ @showEmojiLoader $emojiButton
+ @addAward votesBlock, awardUrl, mutualVote, no, ->
+ $emojiButton.removeClass 'is-loading'
+
+
+ showEmojiLoader: ($emojiButton) ->
+
+ $loader = $emojiButton.find '.fa-spinner'
+
+ unless $loader.length
+ $emojiButton.append '<i class="fa fa-spinner fa-spin award-control-icon award-control-icon-loading"></i>'
+
+ $emojiButton.addClass 'is-loading'
isActive: ($emojiButton) -> $emojiButton.hasClass 'active'