gitlab-org--gitlab-foss/app/helpers/avatars_helper.rb
Jacob Schatz 8d1c7c5dc9 Merge branch '20059-environment-list' into 'master'
Resolve "Format branch, tag, and commit in environment list"

## What does this MR do?
Updates Environments page rows to match the new pipeline updates

## Are there points in the code the reviewer needs to double check?
I removed `private` from `avatars_helper.rb` so I could use `user_avatar`.

## What are the relevant issue numbers?
Closes #20059 

## Screenshots (if relevant)
![Screen_Shot_2016-08-08_at_11.44.36_AM](/uploads/62fbb475a7d9cc613fe5ba1715229553/Screen_Shot_2016-08-08_at_11.44.36_AM.png)
![Screen_Shot_2016-08-08_at_11.44.41_AM](/uploads/ce1bd3ab62c0bc8091e9b6f85012ed36/Screen_Shot_2016-08-08_at_11.44.41_AM.png)



See merge request !5687
2016-08-12 17:00:16 +00:00

26 lines
772 B
Ruby

module AvatarsHelper
def author_avatar(commit_or_event, options = {})
user_avatar(options.merge({
user: commit_or_event.author,
user_name: commit_or_event.author_name,
user_email: commit_or_event.author_email,
}))
end
def user_avatar(options = {})
avatar_size = options[:size] || 16
user_name = options[:user].try(:name) || options[:user_name]
avatar = image_tag(
avatar_icon(options[:user] || options[:user_email], avatar_size),
class: "avatar has-tooltip hidden-xs s#{avatar_size}",
alt: "#{user_name}'s avatar",
title: user_name
)
if options[:user]
link_to(avatar, user_path(options[:user]))
elsif options[:user_email]
mail_to(options[:user_email], avatar)
end
end
end