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
Boxiang Sun
gitlab-ce
Commits
f021bc5c
Commit
f021bc5c
authored
Nov 18, 2015
by
Valery Sizov
Committed by
Valery Sizov
Nov 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add stats on hover
parent
36d0442e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
3 deletions
+41
-3
app/assets/javascripts/awards_handler.coffee
app/assets/javascripts/awards_handler.coffee
+30
-2
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+8
-0
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+3
-1
No files found.
app/assets/javascripts/awards_handler.coffee
View file @
f021bc5c
...
@@ -13,6 +13,7 @@ class @AwardsHandler
...
@@ -13,6 +13,7 @@ class @AwardsHandler
counter
=
@
findEmojiIcon
(
emoji
).
siblings
(
".counter"
)
counter
=
@
findEmojiIcon
(
emoji
).
siblings
(
".counter"
)
counter
.
text
(
parseInt
(
counter
.
text
())
+
1
)
counter
.
text
(
parseInt
(
counter
.
text
())
+
1
)
counter
.
parent
().
addClass
(
"active"
)
counter
.
parent
().
addClass
(
"active"
)
@
addMeToAuthorList
(
emoji
)
else
else
@
createEmoji
(
emoji
)
@
createEmoji
(
emoji
)
...
@@ -28,13 +29,38 @@ class @AwardsHandler
...
@@ -28,13 +29,38 @@ class @AwardsHandler
if
parseInt
(
counter
.
text
())
>
1
if
parseInt
(
counter
.
text
())
>
1
counter
.
text
(
parseInt
(
counter
.
text
())
-
1
)
counter
.
text
(
parseInt
(
counter
.
text
())
-
1
)
counter
.
parent
().
removeClass
(
"active"
)
counter
.
parent
().
removeClass
(
"active"
)
@
removeMeFromAuthorList
(
emoji
)
else
else
counter
.
parent
().
remove
()
award
=
counter
.
parent
()
award
.
tooltip
(
"destroy"
)
award
.
remove
()
removeMeFromAuthorList
:
(
emoji
)
->
award_block
=
@
findEmojiIcon
(
emoji
).
parent
()
authors
=
award_block
.
attr
(
"data-original-title"
).
split
(
", "
)
authors
=
_
.
without
(
authors
,
"me"
).
join
(
", "
)
award_block
.
attr
(
"title"
,
authors
)
@
resetTooltip
(
award_block
)
addMeToAuthorList
:
(
emoji
)
->
award_block
=
@
findEmojiIcon
(
emoji
).
parent
()
authors
=
award_block
.
attr
(
"data-original-title"
).
split
(
", "
)
authors
.
push
(
"me"
)
award_block
.
attr
(
"title"
,
authors
.
join
(
", "
))
@
resetTooltip
(
award_block
)
resetTooltip
:
(
award
)
->
award
.
tooltip
(
"destroy"
)
# "destroy" call is asynchronous, this is why we need to set timeout.
setTimeout
(
->
award
.
tooltip
()
),
200
createEmoji
:
(
emoji
)
->
createEmoji
:
(
emoji
)
->
nodes
=
[]
nodes
=
[]
nodes
.
push
(
"<div class='award active'>"
)
nodes
.
push
(
"<div class='award active'
title='me'
>"
)
nodes
.
push
(
"<div class='icon' data-emoji='"
+
emoji
+
"'>"
)
nodes
.
push
(
"<div class='icon' data-emoji='"
+
emoji
+
"'>"
)
nodes
.
push
(
@
getImage
(
emoji
))
nodes
.
push
(
@
getImage
(
emoji
))
nodes
.
push
(
"</div>"
)
nodes
.
push
(
"</div>"
)
...
@@ -43,6 +69,8 @@ class @AwardsHandler
...
@@ -43,6 +69,8 @@ class @AwardsHandler
$
(
".awards-controls"
).
before
(
nodes
.
join
(
"
\n
"
))
$
(
".awards-controls"
).
before
(
nodes
.
join
(
"
\n
"
))
$
(
".award"
).
tooltip
()
getImage
:
(
emoji
)
->
getImage
:
(
emoji
)
->
$
(
"li[data-emoji='"
+
emoji
+
"'"
).
html
()
$
(
"li[data-emoji='"
+
emoji
+
"'"
).
html
()
...
...
app/helpers/issues_helper.rb
View file @
f021bc5c
...
@@ -92,6 +92,14 @@ module IssuesHelper
...
@@ -92,6 +92,14 @@ module IssuesHelper
url_to_image
(
emoji_path
)
url_to_image
(
emoji_path
)
end
end
def
emoji_author_list
(
notes
,
current_user
)
list
=
notes
.
map
do
|
note
|
note
.
author
==
current_user
?
"me"
:
note
.
author
.
username
end
list
.
join
(
", "
)
end
# Required for Gitlab::Markdown::IssueReferenceFilter
# Required for Gitlab::Markdown::IssueReferenceFilter
module_function
:url_for_issue
module_function
:url_for_issue
end
end
app/views/votes/_votes_block.html.haml
View file @
f021bc5c
.awards.votes-block
.awards.votes-block
-
votable
.
notes
.
awards
.
grouped_awards
.
each
do
|
vote
|
-
votable
.
notes
.
awards
.
grouped_awards
.
each
do
|
vote
|
.
award
{
class:
(
"active"
if
vote
.
last
.
pluck
(
:author_id
).
include?
(
current_user
.
id
))}
.
award
{
class:
(
"active"
if
vote
.
last
.
pluck
(
:author_id
).
include?
(
current_user
.
id
))
,
title:
emoji_author_list
(
vote
.
last
,
current_user
)
}
.icon
{
"data-emoji"
=>
"#{vote.first}"
}
.icon
{
"data-emoji"
=>
"#{vote.first}"
}
=
image_tag
url_to_emoji
(
vote
.
first
),
height:
"20px"
,
width:
"20px"
=
image_tag
url_to_emoji
(
vote
.
first
),
height:
"20px"
,
width:
"20px"
.counter
.counter
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
emoji = $(this).find(".icon").data("emoji")
emoji = $(this).find(".icon").data("emoji")
awards_handler.addAward(emoji)
awards_handler.addAward(emoji)
$(".award").tooltip()
\ 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