Commit 02130572aa4dfa420d259b8a15cd26c88b538c45

Authored by Nathan Broadbent
1 parent e7edcb8f
Exists in master and in 1 other branch production

Show gravatar on users index table, and in heading bar of users show page

app/assets/stylesheets/errbit.css
... ... @@ -893,3 +893,12 @@ table.errs tr td.message .inline_comment em.commenter {
893 893  
894 894 .current.asc:after { content: ' ↑'; }
895 895 .current.desc:after { content: ' ↓'; }
  896 +
  897 +
  898 +table.users td {
  899 + vertical-align: middle;
  900 +}
  901 +table.users td img.gravatar {
  902 + vertical-align: middle;
  903 + margin-left: 3px;
  904 +}
... ...
app/helpers/errs_helper.rb
... ... @@ -15,15 +15,17 @@ module ErrsHelper
15 15 end
16 16  
17 17 def gravatar_tag(email, options = {})
  18 + image_tag gravatar_url(email, options), :alt => email, :class => 'gravatar'
  19 + end
  20 +
  21 + def gravatar_url(email, options = {})
18 22 default_options = {
19 23 :d => Errbit::Config.gravatar_default,
20   - :alt => email,
21   - :class => 'gravatar'
22 24 }
23 25 options.reverse_merge! default_options
24 26 params = options.extract!(:s, :d).delete_if { |k, v| v.blank? }
25 27 email_hash = Digest::MD5.hexdigest(email)
26   - image_tag "http://www.gravatar.com/avatar/#{email_hash}?#{params.to_query}", options
  28 + "http://www.gravatar.com/avatar/#{email_hash}?#{params.to_query}"
27 29 end
28 30 end
29 31  
... ...
app/views/layouts/application.html.haml
... ... @@ -18,7 +18,7 @@
18 18 = render 'shared/navigation' if current_user
19 19 = render 'shared/session'
20 20 #content-wrapper
21   - #content-title{ :class => (yield :title_css_class).to_s }
  21 + #content-title{ :class => (yield :title_css_class).to_s, :style => (yield :title_style) }
22 22 %h1= yield :title
23 23 %span.meta= yield :meta
24 24 - if (action_bar = yield(:action_bar)).present?
... ... @@ -33,3 +33,4 @@
33 33 #footer= "Powered by #{link_to 'Errbit', 'http://github.com/errbit/errbit', :target => '_blank'}: the open source error catcher.".html_safe
34 34 = yield :scripts
35 35  
  36 += yield :before_title
36 37 \ No newline at end of file
... ...
app/views/users/index.html.haml
... ... @@ -2,9 +2,11 @@
2 2 - content_for :action_bar do
3 3 %span= link_to('Add a New User', new_user_path, :class => 'add')
4 4  
5   -%table
  5 +%table.users
6 6 %thead
7 7 %tr
  8 + - if Errbit::Config.use_gravatar
  9 + %th
8 10 %th Name
9 11 - if Errbit::Config.user_has_username
10 12 %th Username
... ... @@ -13,6 +15,8 @@
13 15 %tbody
14 16 - @users.each do |user|
15 17 %tr
  18 + - if Errbit::Config.use_gravatar
  19 + %td= gravatar_tag user.email, :s => 24
16 20 %td.nowrap= link_to user.name, user_path(user)
17 21 - if Errbit::Config.user_has_username
18 22 %td= user.username
... ...
app/views/users/show.html.haml
1 1 - content_for :title, @user.name
  2 +- if Errbit::Config.use_gravatar
  3 + - content_for :title_style do
  4 + background: url('#{gravatar_url @user.email, :s => 86}') no-repeat;
  5 + padding-left: 106px;
  6 +
2 7 - content_for :action_bar do
3 8 = render 'shared/link_github_account', :user => @user
4 9 %span= link_to('Add a New User', new_user_path, :class => 'add')
5 10 = link_to 'edit', edit_user_path(@user), :class => 'button'
6 11 = link_to 'destroy', user_path(@user), :method => :delete, :data => { :confirm => 'Seriously?' }, :class => 'button'
7 12  
8   -
9 13 %table.single_user
10 14 %tr
11 15 %th Email
... ...