diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f33f6c3..c0e04db 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -412,4 +412,25 @@ module ApplicationHelper end end + def gravatar_url_for(email, options = {}) + # Ta dando erro de roteamento + url_for( { :gravatar_id => Digest::MD5.hexdigest(email), + :host => 'www.gravatar.com', + :protocol => 'http://', + :only_path => false, + :controller => 'avatar.php' + }.merge(options) ) + end + + def str_gravatar_url_for(email, options = {}) + url = 'http://www.gravatar.com/avatar.php?gravatar_id=' + + Digest::MD5.hexdigest(email) + { :only_path => false }.merge(options).each { |k,v| + url += ( '&%s=%s' % [ k,v ] ) + } + # we can set the default imgage with this: + # :default => 'DOMAIN/images/icons-app/gravatar-minor.gif' + url + end + end diff --git a/app/views/content_viewer/_comment.rhtml b/app/views/content_viewer/_comment.rhtml index 8e8aee3..85a2b2a 100644 --- a/app/views/content_viewer/_comment.rhtml +++ b/app/views/content_viewer/_comment.rhtml @@ -1,11 +1,15 @@ -
<%= comment.title %>
@@ -13,6 +17,7 @@ <%= _('By %{author} on %{date}') % { :author => comment.author ? link_to(comment.author.name, comment.author.url) : content_tag('u', comment.name), :date => show_time(comment.created_on) } %> + <%= '' + _('(unauthenticated user)') if ! comment.author %>