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
Léo-Paul Géneau
gitlab-ce
Commits
ee229300
Commit
ee229300
authored
Aug 22, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove tooltip from filtered search user
parent
f7dd0468
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
9 deletions
+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
No files found.
app/helpers/avatars_helper.rb
View file @
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
View file @
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
View file @
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
)
}
...
...
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