BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
abb9981d
Commit
abb9981d
authored
Sep 22, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `data-src` when image is to be lazy loaded, use `tag` helper instead of `image_tag` helper
parent
31d43e34
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
avatars_helper.rb
app/helpers/avatars_helper.rb
+16
-9
No files found.
app/helpers/avatars_helper.rb
View file @
abb9981d
...
...
@@ -13,22 +13,29 @@ module AvatarsHelper
user_name
=
options
[
:user
].
try
(
:name
)
||
options
[
:user_name
]
avatar_url
=
options
[
:url
]
||
avatar_icon
(
options
[
:user
]
||
options
[
:user_email
],
avatar_size
)
has_tooltip
=
options
[
:has_tooltip
].
nil?
?
true
:
options
[
:has_tooltip
]
data_attributes
=
{}
data_attributes
=
options
[
:data
]
||
{}
css_class
=
%W[avatar s
#{
avatar_size
}
]
.
push
(
*
options
[
:css_class
])
if
has_tooltip
css_class
.
push
(
'has-tooltip'
)
data_attributes
=
{
container:
'body'
}
data_attributes
[
:container
]
=
'body'
end
image_tag
(
avatar_url
,
if
options
[
:lazy
]
css_class
<<
'lazy'
data_attributes
[
:src
]
=
avatar_url
avatar_url
=
LazyImageTagHelper
.
placeholder_image
end
image_options
=
{
alt:
"
#{
user_name
}
's avatar"
,
src:
avatar_url
,
data:
data_attributes
,
class:
css_class
,
alt:
"
#{
user_name
}
's avatar"
,
title:
user_name
,
data:
data_attributes
,
lazy:
true
)
title:
user_name
}
tag
(
:img
,
image_options
)
end
def
user_avatar
(
options
=
{})
...
...
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