Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
1d48904a
Unverified
Commit
1d48904a
authored
Feb 13, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show avatars in ajax user selectbox
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
abb31213
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+2
-2
app/assets/stylesheets/generic/selects.scss
app/assets/stylesheets/generic/selects.scss
+4
-0
lib/api/entities.rb
lib/api/entities.rb
+6
-0
No files found.
app/assets/javascripts/users_select.js.coffee
View file @
1d48904a
$
->
userFormatResult
=
(
user
)
->
if
user
.
avatar
avatar
=
user
.
avatar
.
url
if
user
.
avatar
_url
avatar
=
user
.
avatar
_
url
else
if
gon
.
gravatar_enabled
avatar
=
gon
.
gravatar_url
avatar
=
avatar
.
replace
(
'%{hash}'
,
md5
(
user
.
email
))
...
...
app/assets/stylesheets/generic/selects.scss
View file @
1d48904a
...
...
@@ -78,3 +78,7 @@ select {
.project-refs-form
.select2-container
{
margin-right
:
10px
;
}
.ajax-users-dropdown
.select2-search
{
padding-top
:
4px
;
}
lib/api/entities.rb
View file @
1d48904a
...
...
@@ -6,6 +6,12 @@ class User < Grape::Entity
expose
:is_admin?
,
as: :is_admin
expose
:can_create_group?
,
as: :can_create_group
expose
:can_create_project?
,
as: :can_create_project
expose
:avatar_url
do
|
user
,
options
|
if
user
.
avatar
.
present?
user
.
avatar
.
url
end
end
end
class
UserSafe
<
Grape
::
Entity
...
...
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