Commit 1d48904ac807c6d382c8965329085b321381cc3d
1 parent
abb31213
Exists in
spb-stable
and in
3 other branches
Show avatars in ajax user selectbox
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
12 additions
and
2 deletions
Show diff stats
app/assets/javascripts/users_select.js.coffee
1 | $ -> | 1 | $ -> |
2 | userFormatResult = (user) -> | 2 | userFormatResult = (user) -> |
3 | - if user.avatar | ||
4 | - avatar = user.avatar.url | 3 | + if user.avatar_url |
4 | + avatar = user.avatar_url | ||
5 | else if gon.gravatar_enabled | 5 | else if gon.gravatar_enabled |
6 | avatar = gon.gravatar_url | 6 | avatar = gon.gravatar_url |
7 | avatar = avatar.replace('%{hash}', md5(user.email)) | 7 | avatar = avatar.replace('%{hash}', md5(user.email)) |
app/assets/stylesheets/generic/selects.scss
lib/api/entities.rb
@@ -6,6 +6,12 @@ module API | @@ -6,6 +6,12 @@ module API | ||
6 | expose :is_admin?, as: :is_admin | 6 | expose :is_admin?, as: :is_admin |
7 | expose :can_create_group?, as: :can_create_group | 7 | expose :can_create_group?, as: :can_create_group |
8 | expose :can_create_project?, as: :can_create_project | 8 | expose :can_create_project?, as: :can_create_project |
9 | + | ||
10 | + expose :avatar_url do |user, options| | ||
11 | + if user.avatar.present? | ||
12 | + user.avatar.url | ||
13 | + end | ||
14 | + end | ||
9 | end | 15 | end |
10 | 16 | ||
11 | class UserSafe < Grape::Entity | 17 | class UserSafe < Grape::Entity |