blob: a4347bd18ce3cabda4f7b4f45981397cd917adb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
module UsersHelper
def user_gravatar_image_tag(user, size = 64)
gravatar_image_tag user.email, :alt => "", :class => "preview", :gravatar => { :default => user_default_avatar , :size => size }
end
def user_default_avatar
return "#{authenticated_root_url}#{image_path('icons/user.png')}" if Rails.application.config.relative_url_root.blank?
relative_url_root = Rails.application.config.relative_url_root.gsub( /\//, '')
"#{authenticated_root_url}#{image_path('icons/user.png')}".
sub( Regexp.new("/#{relative_url_root}/#{relative_url_root}/"), "/#{relative_url_root}/").
sub( Regexp.new("/#{relative_url_root}//#{relative_url_root}/"), "/#{relative_url_root}/")
end
end
|