aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDavid Jones <dgjones@gmail.com>2011-05-31 13:52:48 +1200
committerDavid Jones <dgjones@gmail.com>2011-05-31 13:52:48 +1200
commit7bb8b056f5b181cfdc88afa60799f3a669d9913f (patch)
tree1242f7e6cf5f05c2013a05d3138576072cdf003e /app
parentb7894a900b3f893d260af9159c49f6f7aa78bd50 (diff)
parent8482525f22136018e18519bdfc0e61ca015173f1 (diff)
downloadrefinerycms-blog-7bb8b056f5b181cfdc88afa60799f3a669d9913f.tar.gz
refinerycms-blog-7bb8b056f5b181cfdc88afa60799f3a669d9913f.tar.bz2
refinerycms-blog-7bb8b056f5b181cfdc88afa60799f3a669d9913f.zip
Merge branch 'master' of github.com:resolve/refinerycms-blog
Diffstat (limited to 'app')
-rw-r--r--app/models/blog_comment.rb7
-rw-r--r--app/views/blog/posts/_comment.html.erb1
2 files changed, 8 insertions, 0 deletions
diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb
index 13aceb1..6216cc2 100644
--- a/app/models/blog_comment.rb
+++ b/app/models/blog_comment.rb
@@ -19,6 +19,13 @@ class BlogComment < ActiveRecord::Base
scope :approved, :conditions => {:state => 'approved'}
scope :rejected, :conditions => {:state => 'rejected'}
+ def avatar_url(options = {})
+ options = {:size => 60}
+ require 'digest/md5'
+ size = ("?s=#{options[:size]}" if options[:size])
+ "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg"
+ end
+
def approve!
self.update_attribute(:state, 'approved')
end
diff --git a/app/views/blog/posts/_comment.html.erb b/app/views/blog/posts/_comment.html.erb
index ba4a508..17b2002 100644
--- a/app/views/blog/posts/_comment.html.erb
+++ b/app/views/blog/posts/_comment.html.erb
@@ -1,4 +1,5 @@
<article class='blog_comment_message' id='<%= "comment-#{comment.to_param}" %>'>
+ <%= image_tag comment.avatar_url, :alt => comment.name, :class => 'avatar' %>
<%= simple_format auto_link(comment.message.to_s) %>
<footer class='blog_comment_author'>
<p>