Commit 25a48932 authored by Phil Hughes's avatar Phil Hughes Committed by Fatih Acet

Removes buttons in notes body

parent f2f2e072
......@@ -2,7 +2,9 @@ class @AwardsHandler
constructor: ->
@aliases = emojiAliases()
$(document).on "click", ".js-add-award", (event) =>
$(document)
.off "click", ".js-add-award"
.on "click", ".js-add-award", (event) =>
event.stopPropagation()
event.preventDefault()
......@@ -72,40 +74,42 @@ class @AwardsHandler
@addEmojiToFrequentlyUsedList(emoji)
emoji = @normilizeEmojiName(emoji)
$emojiBtn = @findEmojiIcon(emoji)
$emojiBtn = @findEmojiIcon(emoji).parent()
if $emojiBtn.length > 0
if @isActive($emojiBtn)
@decrementCounter(emoji)
@decrementCounter($emojiBtn, emoji)
else
counter = @findEmojiIcon(emoji).siblings(".js-counter")
counter = $emojiBtn.siblings(".js-counter")
counter.text(parseInt(counter.text()) + 1)
counter.parent().addClass("active")
$emojiBtn.addClass("active")
@addMeToUserList(emoji)
else
@createEmoji(emoji)
isActive: ($emojiBtn) ->
$emojiBtn.parent().hasClass("active")
decrementCounter: (emoji) ->
counter = @findEmojiIcon(emoji).siblings(".js-counter")
emojiIcon = counter.parent()
if parseInt(counter.text()) > 1
counter.text(parseInt(counter.text()) - 1)
emojiIcon.removeClass("active")
@removeMeFromUserList(emoji)
else if emoji == "thumbsup" || emoji == "thumbsdown"
emojiIcon.tooltip("destroy")
counter.text(0)
emojiIcon.removeClass("active")
@removeMeFromUserList(emoji)
$emojiBtn.hasClass("active")
decrementCounter: ($emojiBtn, emoji) ->
isntNoteBody = $emojiBtn.closest('.note-body').length is 0
counter = $('.js-counter', $emojiBtn)
counterNumber = parseInt(counter.text())
if counterNumber > 1
counter.text(counterNumber - 1)
@removeMeFromUserList($emojiBtn, emoji)
else if (emoji == "thumbsup" || emoji == "thumbsdown") && isntNoteBody
$emojiBtn.tooltip("destroy")
counter.text('0')
@removeMeFromUserList($emojiBtn, emoji)
else
emojiIcon.tooltip("destroy")
emojiIcon.remove()
$emojiBtn.tooltip("destroy")
$emojiBtn.remove()
removeMeFromUserList: (emoji) ->
award_block = @findEmojiIcon(emoji).parent()
$emojiBtn.removeClass("active")
removeMeFromUserList: ($emojiBtn, emoji) ->
award_block = $emojiBtn
authors = award_block
.attr("data-original-title")
.split(", ")
......
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