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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
27577e8e
Commit
27577e8e
authored
Oct 04, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Tests
parent
6168e33e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
app/helpers/lazy_image_tag_helper.rb
app/helpers/lazy_image_tag_helper.rb
+6
-5
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+1
-1
spec/helpers/groups_helper_spec.rb
spec/helpers/groups_helper_spec.rb
+2
-2
No files found.
app/helpers/lazy_image_tag_helper.rb
View file @
27577e8e
...
...
@@ -9,11 +9,12 @@ module LazyImageTagHelper
unless
options
.
delete
(
:lazy
)
==
false
options
[
:data
]
||=
{}
if
options
.
delete
(
:use_original_source
)
options
[
:data
][
:src
]
=
source
options
[
:data
][
:src
]
=
if
options
.
delete
(
:use_original_source
)
source
else
options
[
:data
][
:src
]
=
path_to_image
(
source
)
path_to_image
(
source
)
end
options
[
:class
]
||=
""
options
[
:class
]
<<
" lazy"
...
...
spec/helpers/application_helper_spec.rb
View file @
27577e8e
...
...
@@ -60,7 +60,7 @@ describe ApplicationHelper do
let
(
:asset_host
)
{
'http://assets'
}
it
'returns an url for the avatar'
do
project
=
create
(
:project
,
avatar:
File
.
open
(
uploaded_image_temp_path
))
project
=
create
(
:project
,
:public
,
avatar:
File
.
open
(
uploaded_image_temp_path
))
avatar_url
=
"/uploads/-/system/project/avatar/
#{
project
.
id
}
/banana_sample.gif"
expect
(
helper
.
project_icon
(
project
.
full_path
).
to_s
)
...
...
spec/helpers/groups_helper_spec.rb
View file @
27577e8e
...
...
@@ -15,13 +15,13 @@ describe GroupsHelper do
avatar_url
=
"/uploads/-/system/group/avatar/
#{
group
.
id
}
/banana_sample.gif"
expect
(
group_icon
(
group
).
to_s
)
expect
(
helper
.
group_icon
(
group
).
to_s
)
.
to
eq
"<img data-src=
\"
#{
avatar_url
}
\"
class=
\"
lazy
\"
src=
\"
#{
LazyImageTagHelper
.
placeholder_image
}
\"
/>"
allow
(
ActionController
::
Base
).
to
receive
(
:asset_host
).
and_return
(
asset_host
)
avatar_url
=
"
#{
asset_host
}
/uploads/-/system/group/avatar/
#{
group
.
id
}
/banana_sample.gif"
expect
(
group_icon
(
group
).
to_s
)
expect
(
helper
.
group_icon
(
group
).
to_s
)
.
to
eq
"<img data-src=
\"
#{
avatar_url
}
\"
class=
\"
lazy
\"
src=
\"
#{
LazyImageTagHelper
.
placeholder_image
}
\"
/>"
end
end
...
...
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