Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f021bc5c
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f021bc5c
编写于
11月 18, 2015
作者:
V
Valery Sizov
提交者:
Valery Sizov
11月 19, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add stats on hover
上级
36d0442e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
41 addition
and
3 deletion
+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
未找到文件。
app/assets/javascripts/awards_handler.coffee
浏览文件 @
f021bc5c
...
...
@@ -13,6 +13,7 @@ class @AwardsHandler
counter
=
@
findEmojiIcon
(
emoji
).
siblings
(
".counter"
)
counter
.
text
(
parseInt
(
counter
.
text
())
+
1
)
counter
.
parent
().
addClass
(
"active"
)
@
addMeToAuthorList
(
emoji
)
else
@
createEmoji
(
emoji
)
...
...
@@ -28,13 +29,38 @@ class @AwardsHandler
if
parseInt
(
counter
.
text
())
>
1
counter
.
text
(
parseInt
(
counter
.
text
())
-
1
)
counter
.
parent
().
removeClass
(
"active"
)
@
removeMeFromAuthorList
(
emoji
)
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
)
->
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
(
@
getImage
(
emoji
))
nodes
.
push
(
"</div>"
)
...
...
@@ -43,6 +69,8 @@ class @AwardsHandler
$
(
".awards-controls"
).
before
(
nodes
.
join
(
"
\n
"
))
$
(
".award"
).
tooltip
()
getImage
:
(
emoji
)
->
$
(
"li[data-emoji='"
+
emoji
+
"'"
).
html
()
...
...
app/helpers/issues_helper.rb
浏览文件 @
f021bc5c
...
...
@@ -92,6 +92,14 @@ module IssuesHelper
url_to_image
(
emoji_path
)
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
module_function
:url_for_issue
end
app/views/votes/_votes_block.html.haml
浏览文件 @
f021bc5c
.awards.votes-block
-
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}"
}
=
image_tag
url_to_emoji
(
vote
.
first
),
height:
"20px"
,
width:
"20px"
.counter
...
...
@@ -28,6 +28,8 @@
emoji = $(this).find(".icon").data("emoji")
awards_handler.addAward(emoji)
$(".award").tooltip()
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录