Commit 1d48904ac807c6d382c8965329085b321381cc3d

Authored by Dmitriy Zaporozhets
1 parent abb31213

Show avatars in ajax user selectbox

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/javascripts/users_select.js.coffee
1 1 $ ->
2 2 userFormatResult = (user) ->
3   - if user.avatar
4   - avatar = user.avatar.url
  3 + if user.avatar_url
  4 + avatar = user.avatar_url
5 5 else if gon.gravatar_enabled
6 6 avatar = gon.gravatar_url
7 7 avatar = avatar.replace('%{hash}', md5(user.email))
... ...
app/assets/stylesheets/generic/selects.scss
... ... @@ -78,3 +78,7 @@ select {
78 78 .project-refs-form .select2-container {
79 79 margin-right: 10px;
80 80 }
  81 +
  82 +.ajax-users-dropdown .select2-search {
  83 + padding-top: 4px;
  84 +}
... ...
lib/api/entities.rb
... ... @@ -6,6 +6,12 @@ module API
6 6 expose :is_admin?, as: :is_admin
7 7 expose :can_create_group?, as: :can_create_group
8 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 15 end
10 16  
11 17 class UserSafe < Grape::Entity
... ...