added gravatar support

This commit is contained in:
pixeldesu 2014-11-30 14:31:38 +01:00
parent 409cb8aa66
commit 2b81ad86db
3 changed files with 6 additions and 2 deletions

View file

@ -49,4 +49,8 @@ module ApplicationHelper
def privileged?(user) def privileged?(user)
(current_user && (current_user == user || current_user.admin?)) ? true : false (current_user && (current_user == user || current_user.admin?)) ? true : false
end end
def gravatar_url(user)
"//www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user.email)}"
end
end end

View file

@ -2,7 +2,7 @@
.panel-heading .panel-heading
.media .media
%a.pull-left{href: '#'} %a.pull-left{href: '#'}
%img.img-rounded.img-answerbox %img.img-rounded.img-answerbox{src: gravatar_url(a.question.user)}
.media-body .media-body
%h6.text-muted.media-heading.answerbox-question-user= user_screen_name a.question.user, a.question.author_is_anonymous %h6.text-muted.media-heading.answerbox-question-user= user_screen_name a.question.user, a.question.author_is_anonymous
%p.answerbox-question-text= a.question.content %p.answerbox-question-text= a.question.content

View file

@ -4,7 +4,7 @@
.panel-body .panel-body
.row .row
.col-md-12.col-xs-12.col-sm-9 .col-md-12.col-xs-12.col-sm-9
%img.img-rounded.img-profile %img.img-rounded.img-profile{src: gravatar_url(@user)}
- if @user.display_name.blank? - if @user.display_name.blank?
%h1= @user.screen_name %h1= @user.screen_name
- else - else