diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2017-06-02 10:42:18 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-06-02 10:42:18 +0300 |
commit | f2b34fb208020706a5b5a73b2e50473bfda2c745 (patch) | |
tree | c28564658ff45cbb1078911e08afb5493e16ca16 /app/helpers | |
parent | 5cb8ad6c57bc8588add7ae47a82842a707ab2298 (diff) |
Show current user immediately in issuable filters
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/avatars_helper.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index b7e0ff8ecd0..bbe7f3c8fb4 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -8,18 +8,28 @@ module AvatarsHelper })) end - def user_avatar(options = {}) + def user_avatar_without_link(options = {}) avatar_size = options[:size] || 16 user_name = options[:user].try(:name) || options[:user_name] css_class = options[:css_class] || '' - - avatar = image_tag( - avatar_icon(options[:user] || options[:user_email], avatar_size), + avatar_url = options[:url] || avatar_icon(options[:user] || options[:user_email], avatar_size) + data_attributes = { container: 'body' } + + if options[:lazy] + data_attributes[:src] = avatar_url + end + + image_tag( + options[:lazy] ? '' : avatar_url, class: "avatar has-tooltip s#{avatar_size} #{css_class}", alt: "#{user_name}'s avatar", title: user_name, - data: { container: 'body' } + data: data_attributes ) + end + + def user_avatar(options = {}) + avatar = user_avatar_without_link(options) if options[:user] link_to(avatar, user_path(options[:user])) |