Skip to content

Commit 6290306

Browse files
committed
Adds title to emoticons
Signed-off-by: Akash Manohar J <[email protected]>
1 parent 2d4d784 commit 6290306

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/assets/javascripts/backbone/plugins/emoticons.js.coffee

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Kandan.Plugins.Emoticons
33
@options:
44
regex: /\([a-zA-Z]+\)/g
55
template: _.template '''
6-
<img class="emoticon-embed" src="/assets/emoticons/<%= emoticon %>" height="30" width="30" />
6+
<img class="emoticon-embed" src="/assets/emoticons/<%= emoticon %>" title="<%= title %>" height="30" width="30" />
77
'''
88

99

@@ -37,10 +37,11 @@ class Kandan.Plugins.Emoticons
3737
matches = message.content.match(@options.regex)
3838
for match in _.unique(matches)
3939
emoticon = @emoticons[match]
40+
title = match.replace(/\(|\)/g, "")
4041
needle = match.replace('(', '\\(').replace(')', '\\)')
4142
search = new RegExp(needle, 'g')
4243
console.log(search)
43-
replacement = @options.template({ emoticon: emoticon })
44+
replacement = @options.template({ emoticon: emoticon, title: title})
4445
message.content = message.content.replace(search, replacement) if emoticon
4546
console.log(message.content)
4647
return Kandan.Helpers.Activities.buildFromBaseTemplate(message)

0 commit comments

Comments
 (0)