23 lines
481 B
Ruby
Executable File
23 lines
481 B
Ruby
Executable File
module AvatarHelper
|
|
|
|
|
|
|
|
|
|
def avatar_tag (user, size, options={})
|
|
|
|
if user[:color] == nil
|
|
color = "#3c6a80"
|
|
else
|
|
color = user[:color]
|
|
end
|
|
|
|
if user[:current_avatar] == nil
|
|
image = image_url("avatar-placeholder-#{size}.png")
|
|
else
|
|
image = user[:current_avatar][size]
|
|
end
|
|
|
|
"<img style=\"background-color:#{color};#{options[:style]}\" src=\"#{image}\" class=\"avatar #{options[:class]}\">".html_safe
|
|
end
|
|
end
|