Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
23df515f
Commit
23df515f
authored
Nov 18, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emoji: fix image of emoji when it is submitted via comment
parent
d8676f18
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
9 deletions
+17
-9
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+10
-6
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+1
-1
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+1
-0
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+1
-1
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+0
-1
lib/award_emoji.rb
lib/award_emoji.rb
+4
-0
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
23df515f
...
...
@@ -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
,
{
...
...
app/assets/javascripts/notes.js.coffee
View file @
23df515f
...
...
@@ -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
...
...
app/controllers/projects/notes_controller.rb
View file @
23df515f
...
...
@@ -133,6 +133,7 @@ class Projects::NotesController < Projects::ApplicationController
discussion_id:
note
.
discussion_id
,
html:
note_to_html
(
note
),
award:
note
.
is_award
,
emoji_path:
note
.
is_award
?
::
AwardEmoji
.
path_to_emoji_image
(
note
.
note
)
:
""
,
note:
note
.
note
,
discussion_html:
note_to_discussion_html
(
note
),
discussion_with_diff_html:
note_to_discussion_with_diff_html
(
note
)
...
...
app/helpers/issues_helper.rb
View file @
23df515f
...
...
@@ -88,7 +88,7 @@ module IssuesHelper
end
def
url_to_emoji
(
name
)
emoji_path
=
"emoji/
#{
Emoji
.
emoji_filename
(
name
)
}
.png"
emoji_path
=
::
AwardEmoji
.
path_to_emoji_image
(
name
)
url_to_image
(
emoji_path
)
end
...
...
app/views/votes/_votes_block.html.haml
View file @
23df515f
...
...
@@ -12,7 +12,6 @@
-
emoji_list
.
each
do
|
emoji
|
%li
{
"data-emoji"
=>
"#{emoji}"
}=
image_tag
url_to_emoji
(
emoji
),
height:
"20px"
,
width:
"20px"
:coffeescript
post_emoji_url = "
#{
award_toggle_namespace_project_notes_path
(
@project
.
namespace
,
@project
)
}
"
noteable_type = "
#{
votable
.
class
}
"
...
...
lib/award_emoji.rb
View file @
23df515f
...
...
@@ -3,4 +3,8 @@ class AwardEmoji
"beers"
,
"disappointed"
,
"ok_hand"
,
"helicopter"
,
"shit"
,
"airplane"
,
"alarm_clock"
,
"ambulance"
,
"anguished"
,
"two_hearts"
,
"wink"
]
def
self
.
path_to_emoji_image
(
name
)
"emoji/
#{
Emoji
.
emoji_filename
(
name
)
}
.png"
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment