summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-11-18 23:59:58 +0200
committerValery Sizov <vsv2711@gmail.com>2015-11-19 01:26:00 +0200
commit23df515fd09661a690c0c0a651e131bc3a6d0191 (patch)
treea8583bef6f0c96c3c99d8b141d00a5638035b008 /app/assets
parentd8676f18fcbd6b78af472b8b00c29f20820a74a9 (diff)
downloadgitlab-ce-23df515fd09661a690c0c0a651e131bc3a6d0191.tar.gz
Emoji: fix image of emoji when it is submitted via comment
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/awards_handler.coffee16
-rw-r--r--app/assets/javascripts/notes.js.coffee2
2 files changed, 11 insertions, 7 deletions
diff --git a/app/assets/javascripts/awards_handler.coffee b/app/assets/javascripts/awards_handler.coffee
index 29b11b0cc58..cac9c10332a 100644
--- a/app/assets/javascripts/awards_handler.coffee
+++ b/app/assets/javascripts/awards_handler.coffee
@@ -5,7 +5,7 @@ class @AwardsHandler
@postEmoji emoji, =>
@addAwardToEmojiBar(emoji)
- addAwardToEmojiBar: (emoji) ->
+ addAwardToEmojiBar: (emoji, custom_path = '') ->
if @exist(emoji)
if @isActive(emoji)
@decrementCounter(emoji)
@@ -15,7 +15,7 @@ class @AwardsHandler
counter.parent().addClass("active")
@addMeToAuthorList(emoji)
else
- @createEmoji(emoji)
+ @createEmoji(emoji, custom_path)
exist: (emoji) ->
@findEmojiIcon(emoji).length > 0
@@ -58,11 +58,11 @@ class @AwardsHandler
), 200
- createEmoji: (emoji) ->
+ createEmoji: (emoji, custom_path) ->
nodes = []
nodes.push("<div class='award active' title='me'>")
nodes.push("<div class='icon' data-emoji='" + emoji + "'>")
- nodes.push(@getImage(emoji))
+ nodes.push(@getImage(emoji, custom_path))
nodes.push("</div>")
nodes.push("<div class='counter'>1")
nodes.push("</div></div>")
@@ -71,8 +71,12 @@ class @AwardsHandler
$(".award").tooltip()
- getImage: (emoji) ->
- $("li[data-emoji='" + emoji + "'").html()
+ getImage: (emoji, custom_path) ->
+ if custom_path
+ $(".awards-menu li").first().html().replace(/emoji\/.*\.png/, custom_path)
+ else
+ $("li[data-emoji='" + emoji + "'").html()
+
postEmoji: (emoji, callback) ->
$.post @post_emoji_url, {
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 73a95c455e8..7de7632201d 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -121,7 +121,7 @@ class @Notes
@initTaskList()
if note.award
- awards_handler.addAwardToEmojiBar(note.note)
+ awards_handler.addAwardToEmojiBar(note.note, note.emoji_path)
###
Check if note does not exists on page