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
5f41cddf
Commit
5f41cddf
authored
Oct 09, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Based on MR simplified the logic
parent
9f228449
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
17 deletions
+5
-17
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+2
-14
app/models/concerns/avatarable.rb
app/models/concerns/avatarable.rb
+2
-2
No files found.
app/helpers/application_helper.rb
View file @
5f41cddf
...
@@ -41,7 +41,7 @@ module ApplicationHelper
...
@@ -41,7 +41,7 @@ module ApplicationHelper
end
end
if
project
.
avatar_url
if
project
.
avatar_url
image_tag
project
.
avatar_url
(
use_asset_path:
project
.
public?
)
,
options
image_tag
project
.
avatar_url
,
options
else
# generated icon
else
# generated icon
project_identicon
(
project
,
options
)
project_identicon
(
project
,
options
)
end
end
...
...
app/helpers/groups_helper.rb
View file @
5f41cddf
require
'uri'
module
GroupsHelper
module
GroupsHelper
include
Gitlab
::
CurrentSettings
def
can_change_group_visibility_level?
(
group
)
def
can_change_group_visibility_level?
(
group
)
can?
(
current_user
,
:change_visibility_level
,
group
)
can?
(
current_user
,
:change_visibility_level
,
group
)
...
@@ -22,12 +19,7 @@ module GroupsHelper
...
@@ -22,12 +19,7 @@ module GroupsHelper
end
end
if
group
.
avatar_url
if
group
.
avatar_url
if
group
.
private?
group
.
avatar_url
options
[
:use_original_source
]
=
true
group
.
avatar_url
(
use_asset_path:
false
)
else
group
.
avatar_url
end
else
# No Avatar Icon
else
# No Avatar Icon
ActionController
::
Base
.
helpers
.
image_path
(
'no_group_avatar.png'
)
ActionController
::
Base
.
helpers
.
image_path
(
'no_group_avatar.png'
)
end
end
...
@@ -107,11 +99,7 @@ module GroupsHelper
...
@@ -107,11 +99,7 @@ module GroupsHelper
link_to
(
group_path
(
group
),
class:
"group-path
#{
'breadcrumb-item-text'
unless
for_dropdown
}
js-breadcrumb-item-text
#{
'hidable'
if
hidable
}
"
)
do
link_to
(
group_path
(
group
),
class:
"group-path
#{
'breadcrumb-item-text'
unless
for_dropdown
}
js-breadcrumb-item-text
#{
'hidable'
if
hidable
}
"
)
do
output
=
output
=
if
(
group
.
try
(
:avatar_url
)
||
show_avatar
)
&&
!
Rails
.
env
.
test?
if
(
group
.
try
(
:avatar_url
)
||
show_avatar
)
&&
!
Rails
.
env
.
test?
if
group
.
private?
group_icon
(
group
,
class:
"avatar-tile"
,
width:
15
,
height:
15
)
group_icon
(
group
,
class:
"avatar-tile"
,
width:
15
,
height:
15
,
use_original_source:
true
)
else
group_icon
(
group
,
class:
"avatar-tile"
,
width:
15
,
height:
15
)
end
else
else
""
""
end
end
...
...
app/models/concerns/avatarable.rb
View file @
5f41cddf
module
Avatarable
module
Avatarable
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
def
avatar_path
(
only_path:
true
,
use_asset_path:
true
)
def
avatar_path
(
only_path:
true
)
return
unless
self
[
:avatar
].
present?
return
unless
self
[
:avatar
].
present?
# If only_path is true then use the relative path of avatar.
# If only_path is true then use the relative path of avatar.
...
@@ -11,7 +11,7 @@ module Avatarable
...
@@ -11,7 +11,7 @@ module Avatarable
# If asset_host is set then it is expected that assets are handled by a standalone host.
# 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.
# That means we do not want to get GitLab's relative_url_root option anymore.
host
=
(
asset_host
.
present?
&&
use_asset_path
)
?
asset_host
:
gitlab_host
host
=
(
asset_host
.
present?
&&
(
!
respond_to?
(
:public?
)
||
public
?)
)
?
asset_host
:
gitlab_host
[
host
,
avatar
.
url
].
join
[
host
,
avatar
.
url
].
join
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