Permalink
Browse files

add simple gravatar functionality

  • Loading branch information...
1 parent 9601f6f commit b55c42d6b7df79996a03f197dcc2c0392bed9f3a @practicingruby practicingruby committed Mar 25, 2012
@@ -1,7 +1,7 @@
class PersonDecorator < ApplicationDecorator
decorates :person, :class => Clubhouse::Client::Person
- allows :name, :email, :github_nickname, :permissions
+ allows :name, :email, :github_nickname, :permissions, :gravatar_url
def has_role?(role, course)
membership = course.course_memberships.for_person(person).first
@@ -2,7 +2,8 @@
%ul
- @members.each do |membership|
- %li
+ %p
+ = image_tag membership.person.gravatar_url(25)
= "#{membership.person.name} // #{membership.role}"
\-
- = link_to "Remove", course_membership_path(membership), :method => :delete
+ = link_to "Remove", course_membership_path(membership), :method => :delete
@@ -12,10 +12,13 @@ def initialize(github_nickname)
raise PersonNotFound if params.nil?
end
+ def gravatar_url(size=80)
+ "http://gravatar.com/avatar/#{email_hash}?s=#{size}"
+ end
+
private
attr_accessor :params
-
end
end
end

0 comments on commit b55c42d

Please sign in to comment.