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
Kazuhiko Shiozaki
gitlab-ce
Commits
7ac62388
Commit
7ac62388
authored
Mar 12, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent database query each time we render group avatar
parent
0f144f36
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
15 deletions
+18
-15
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+0
-9
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+12
-0
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+1
-1
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+1
-1
app/views/dashboard/groups/index.html.haml
app/views/dashboard/groups/index.html.haml
+1
-1
app/views/groups/edit.html.haml
app/views/groups/edit.html.haml
+1
-1
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+1
-1
app/views/users/_groups.html.haml
app/views/users/_groups.html.haml
+1
-1
No files found.
app/helpers/application_helper.rb
View file @
7ac62388
...
@@ -86,15 +86,6 @@ module ApplicationHelper
...
@@ -86,15 +86,6 @@ module ApplicationHelper
end
end
end
end
def
group_icon
(
group_path
)
group
=
Group
.
find_by
(
path:
group_path
)
if
group
&&
group
.
avatar
.
present?
group
.
avatar
.
url
else
image_path
(
'no_group_avatar.png'
)
end
end
def
avatar_icon
(
user_email
=
''
,
size
=
nil
)
def
avatar_icon
(
user_email
=
''
,
size
=
nil
)
user
=
User
.
find_by
(
email:
user_email
)
user
=
User
.
find_by
(
email:
user_email
)
...
...
app/helpers/groups_helper.rb
View file @
7ac62388
...
@@ -40,4 +40,16 @@ module GroupsHelper
...
@@ -40,4 +40,16 @@ module GroupsHelper
false
false
end
end
end
end
def
group_icon
(
group
)
if
group
.
is_a?
(
String
)
group
=
Group
.
find_by
(
path:
group
)
end
if
group
&&
group
.
avatar
.
present?
group
.
avatar
.
url
else
image_path
(
'no_group_avatar.png'
)
end
end
end
end
app/helpers/namespaces_helper.rb
View file @
7ac62388
...
@@ -28,7 +28,7 @@ module NamespacesHelper
...
@@ -28,7 +28,7 @@ module NamespacesHelper
def
namespace_icon
(
namespace
,
size
=
40
)
def
namespace_icon
(
namespace
,
size
=
40
)
if
namespace
.
kind_of?
(
Group
)
if
namespace
.
kind_of?
(
Group
)
group_icon
(
namespace
.
path
)
group_icon
(
namespace
)
else
else
avatar_icon
(
namespace
.
owner
.
email
,
size
)
avatar_icon
(
namespace
.
owner
.
email
,
size
)
end
end
...
...
app/views/admin/groups/show.html.haml
View file @
7ac62388
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
Group info:
Group info:
%ul
.well-list
%ul
.well-list
%li
%li
=
image_tag
group_icon
(
@group
.
path
),
class:
"avatar s60"
=
image_tag
group_icon
(
@group
),
class:
"avatar s60"
%li
%li
%span
.light
Name:
%span
.light
Name:
%strong
=
@group
.
name
%strong
=
@group
.
name
...
...
app/views/dashboard/groups/index.html.haml
View file @
7ac62388
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
%i
.fa.fa-sign-out
%i
.fa.fa-sign-out
Leave
Leave
=
image_tag
group_icon
(
group
.
path
),
class:
"avatar s40 avatar-tile"
=
image_tag
group_icon
(
group
),
class:
"avatar s40 avatar-tile"
=
link_to
group
,
class:
'group-name'
do
=
link_to
group
,
class:
'group-name'
do
%strong
=
group
.
name
%strong
=
group
.
name
...
...
app/views/groups/edit.html.haml
View file @
7ac62388
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
.form-group
.form-group
.col-sm-2
.col-sm-2
.col-sm-10
.col-sm-10
=
image_tag
group_icon
(
@group
.
to_param
),
alt:
''
,
class:
'avatar group-avatar s160'
=
image_tag
group_icon
(
@group
),
alt:
''
,
class:
'avatar group-avatar s160'
%p
.light
%p
.light
-
if
@group
.
avatar?
-
if
@group
.
avatar?
You can change your group avatar here
You can change your group avatar here
...
...
app/views/groups/show.html.haml
View file @
7ac62388
.dashboard
.dashboard
%div
%div
=
image_tag
group_icon
(
@group
.
path
),
class:
"avatar group-avatar s90"
=
image_tag
group_icon
(
@group
),
class:
"avatar group-avatar s90"
.clearfix
.clearfix
%h2
%h2
=
@group
.
name
=
@group
.
name
...
...
app/views/users/_groups.html.haml
View file @
7ac62388
.clearfix
.clearfix
-
groups
.
each
do
|
group
|
-
groups
.
each
do
|
group
|
=
link_to
group
,
class:
'profile-groups-avatars inline'
,
title:
group
.
name
do
=
link_to
group
,
class:
'profile-groups-avatars inline'
,
title:
group
.
name
do
=
image_tag
group_icon
(
group
.
path
),
class:
'avatar group-avatar s40'
=
image_tag
group_icon
(
group
),
class:
'avatar group-avatar s40'
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