Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ee229300
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,发现更多精彩内容 >>
提交
ee229300
编写于
8月 22, 2017
作者:
C
Clement Ho
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove tooltip from filtered search user
上级
f7dd0468
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
9 deletion
+46
-9
app/helpers/avatars_helper.rb
app/helpers/avatars_helper.rb
+9
-2
app/views/shared/issuable/_user_dropdown_item.html.haml
app/views/shared/issuable/_user_dropdown_item.html.haml
+1
-1
spec/helpers/avatars_helper_spec.rb
spec/helpers/avatars_helper_spec.rb
+36
-6
未找到文件。
app/helpers/avatars_helper.rb
浏览文件 @
ee229300
...
...
@@ -12,11 +12,18 @@ module AvatarsHelper
avatar_size
=
options
[
:size
]
||
16
user_name
=
options
[
:user
].
try
(
:name
)
||
options
[
:user_name
]
avatar_url
=
options
[
:url
]
||
avatar_icon
(
options
[
:user
]
||
options
[
:user_email
],
avatar_size
)
data_attributes
=
{
container:
'body'
}
has_tooltip
=
options
[
:has_tooltip
].
nil?
?
true
:
options
[
:has_tooltip
]
data_attributes
=
{}
css_class
=
%W[avatar s
#{
avatar_size
}
]
.
push
(
*
options
[
:css_class
])
if
has_tooltip
css_class
.
push
(
'has-tooltip'
)
data_attributes
=
{
container:
'body'
}
end
image_tag
(
avatar_url
,
class:
%W[avatar has-tooltip s
#{
avatar_size
}
]
.
push
(
*
options
[
:css_class
])
,
class:
css_class
,
alt:
"
#{
user_name
}
's avatar"
,
title:
user_name
,
data:
data_attributes
,
...
...
app/views/shared/issuable/_user_dropdown_item.html.haml
浏览文件 @
ee229300
...
...
@@ -4,7 +4,7 @@
%li
.filter-dropdown-item
{
class:
(
'js-current-user'
if
user
==
current_user
)
}
%button
.btn.btn-link.dropdown-user
{
type: :button
}
.avatar-container.s40
=
user_avatar_without_link
(
user:
user
,
lazy:
avatar
[
:lazy
],
url:
avatar
[
:url
],
size:
40
).
gsub
(
'/images/{{avatar_url}}'
,
'{{avatar_url}}'
).
html_safe
=
user_avatar_without_link
(
user:
user
,
lazy:
avatar
[
:lazy
],
url:
avatar
[
:url
],
size:
40
,
has_tooltip:
false
).
gsub
(
'/images/{{avatar_url}}'
,
'{{avatar_url}}'
).
html_safe
.dropdown-user-details
%span
=
user
.
name
...
...
spec/helpers/avatars_helper_spec.rb
浏览文件 @
ee229300
...
...
@@ -28,7 +28,7 @@ describe AvatarsHelper do
it
'displays user avatar'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
'avatar
has-tooltip s16
lazy'
,
class:
'avatar
s16 has-tooltip
lazy'
,
alt:
"
#{
user
.
name
}
's avatar"
,
title:
user
.
name
,
data:
{
container:
'body'
,
src:
avatar_icon
(
user
,
16
)
}
...
...
@@ -41,7 +41,7 @@ describe AvatarsHelper do
it
'uses provided css_class'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
"avatar
has-tooltip s16
#{
options
[
:css_class
]
}
lazy"
,
class:
"avatar
s16
#{
options
[
:css_class
]
}
has-tooltip
lazy"
,
alt:
"
#{
user
.
name
}
's avatar"
,
title:
user
.
name
,
data:
{
container:
'body'
,
src:
avatar_icon
(
user
,
16
)
}
...
...
@@ -55,7 +55,7 @@ describe AvatarsHelper do
it
'uses provided size'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
"avatar
has-tooltip s
#{
options
[
:size
]
}
lazy"
,
class:
"avatar
s
#{
options
[
:size
]
}
has-tooltip
lazy"
,
alt:
"
#{
user
.
name
}
's avatar"
,
title:
user
.
name
,
data:
{
container:
'body'
,
src:
avatar_icon
(
user
,
options
[
:size
])
}
...
...
@@ -69,7 +69,7 @@ describe AvatarsHelper do
it
'uses provided url'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
'avatar
has-tooltip s16
lazy'
,
class:
'avatar
s16 has-tooltip
lazy'
,
alt:
"
#{
user
.
name
}
's avatar"
,
title:
user
.
name
,
data:
{
container:
'body'
,
src:
options
[
:url
]
}
...
...
@@ -77,6 +77,36 @@ describe AvatarsHelper do
end
end
context
'with has_tooltip parameter'
do
context
'with has_tooltip set to true'
do
let
(
:options
)
{
{
user:
user
,
has_tooltip:
true
}
}
it
'adds has-tooltip'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
'avatar s16 has-tooltip lazy'
,
alt:
"
#{
user
.
name
}
's avatar"
,
title:
user
.
name
,
data:
{
container:
'body'
,
src:
avatar_icon
(
user
,
16
)
}
)
end
end
context
'with has_tooltip set to false'
do
let
(
:options
)
{
{
user:
user
,
has_tooltip:
false
}
}
it
'does not add has-tooltip or data container'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
'avatar s16 lazy'
,
alt:
"
#{
user
.
name
}
's avatar"
,
title:
user
.
name
,
data:
{
src:
avatar_icon
(
user
,
16
)
}
)
end
end
end
context
'with user_name parameter'
do
let
(
:options
)
{
{
user_name:
'Tinky Winky'
,
user_email:
'no@f.un'
}
}
...
...
@@ -86,7 +116,7 @@ describe AvatarsHelper do
it
'prefers user parameter'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
'avatar
has-tooltip s16
lazy'
,
class:
'avatar
s16 has-tooltip
lazy'
,
alt:
"
#{
user
.
name
}
's avatar"
,
title:
user
.
name
,
data:
{
container:
'body'
,
src:
avatar_icon
(
user
,
16
)
}
...
...
@@ -97,7 +127,7 @@ describe AvatarsHelper do
it
'uses user_name and user_email parameter if user is not present'
do
is_expected
.
to
eq
image_tag
(
LazyImageTagHelper
.
placeholder_image
,
class:
'avatar
has-tooltip s16
lazy'
,
class:
'avatar
s16 has-tooltip
lazy'
,
alt:
"
#{
options
[
:user_name
]
}
's avatar"
,
title:
options
[
:user_name
],
data:
{
container:
'body'
,
src:
avatar_icon
(
options
[
:user_email
],
16
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录