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