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
79c80de9
Commit
79c80de9
authored
Sep 22, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Making private project avatars use local paths + Some Group Icons
parent
4a0f720a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+6
-1
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+7
-2
app/helpers/lazy_image_tag_helper.rb
app/helpers/lazy_image_tag_helper.rb
+5
-1
app/models/concerns/avatarable.rb
app/models/concerns/avatarable.rb
+9
-5
No files found.
app/helpers/application_helper.rb
View file @
79c80de9
...
...
@@ -41,7 +41,12 @@ module ApplicationHelper
end
if
project
.
avatar_url
image_tag
project
.
avatar_url
,
options
if
project
.
private?
options
[
:use_original_source
]
=
true
image_tag
project
.
avatar_url
(
use_asset_path:
false
),
options
else
image_tag
project
.
avatar_url
,
options
end
else
# generated icon
project_identicon
(
project
,
options
)
end
...
...
app/helpers/groups_helper.rb
View file @
79c80de9
...
...
@@ -12,7 +12,7 @@ module GroupsHelper
group
=
Group
.
find_by_full_path
(
group
)
end
group
.
try
(
:avatar_url
)
||
ActionController
::
Base
.
helpers
.
image_path
(
'no_group_avatar.png'
)
group
.
try
(
:avatar_url
,
use_asset_path:
false
)
||
ActionController
::
Base
.
helpers
.
image_path
(
'no_group_avatar.png'
)
end
def
group_title
(
group
,
name
=
nil
,
url
=
nil
)
...
...
@@ -89,7 +89,12 @@ module GroupsHelper
link_to
(
group_path
(
group
),
class:
"group-path
#{
'breadcrumb-item-text'
unless
for_dropdown
}
js-breadcrumb-item-text
#{
'hidable'
if
hidable
}
"
)
do
output
=
if
(
group
.
try
(
:avatar_url
)
||
show_avatar
)
&&
!
Rails
.
env
.
test?
image_tag
(
group_icon
(
group
),
class:
"avatar-tile"
,
width:
15
,
height:
15
)
if
group
.
private?
puts
"GROUP IS PRIVATE : "
+
group_icon
(
group
)
image_tag
(
group_icon
(
group
),
class:
"avatar-tile"
,
width:
15
,
height:
15
,
use_original_source:
true
)
else
image_tag
(
group_icon
(
group
),
class:
"avatar-tile"
,
width:
15
,
height:
15
)
end
else
""
end
...
...
app/helpers/lazy_image_tag_helper.rb
View file @
79c80de9
...
...
@@ -9,7 +9,11 @@ module LazyImageTagHelper
unless
options
.
delete
(
:lazy
)
==
false
options
[
:data
]
||=
{}
options
[
:data
][
:src
]
=
path_to_image
(
source
)
unless
options
.
delete
(
:use_original_source
)
==
true
options
[
:data
][
:src
]
=
path_to_image
(
source
)
else
options
[
:data
][
:src
]
=
source
end
options
[
:class
]
||=
""
options
[
:class
]
<<
" lazy"
...
...
app/models/concerns/avatarable.rb
View file @
79c80de9
module
Avatarable
extend
ActiveSupport
::
Concern
def
avatar_path
(
only_path:
true
)
def
avatar_path
(
only_path:
true
,
use_asset_path:
true
)
return
unless
self
[
:avatar
].
present?
# If only_path is true then use the relative path of avatar.
...
...
@@ -9,10 +9,14 @@ module Avatarable
asset_host
=
ActionController
::
Base
.
asset_host
gitlab_host
=
only_path
?
gitlab_config
.
relative_url_root
:
gitlab_config
.
url
# If asset_host is set then it is expected that assets are handled by a standalone host.
# That means we do not want to get GitLab's relative_url_root option anymore.
host
=
asset_host
.
present?
?
asset_host
:
gitlab_host
if
use_asset_path
# If asset_host is set then it is expected that assets are handled by a standalone host.
# That means we do not want to get GitLab's relative_url_root option anymore.
host
=
asset_host
.
present?
?
asset_host
:
gitlab_host
[
host
,
avatar
.
url
].
join
[
host
,
avatar
.
url
].
join
else
avatar
.
url
end
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