Permalink
Browse files

Add gravatar and styling to the user profile page

  • Loading branch information...
1 parent 86ecb51 commit 2fca8d778990ec4f59d53f51d52decd16d176a45 Olivier Schneider committed Feb 17, 2012
Showing with 45 additions and 1 deletion.
  1. +23 −0 app/assets/stylesheets/layout.css.scss
  2. +8 −0 app/helpers/users_helper.rb
  3. +14 −1 app/views/users/show.html.erb
@@ -113,4 +113,27 @@ footer {
nav {
float: none;
}
+}
+/* User show page */
+
+table.profile {
+ width: 100%;
+ margin-bottom: 0;
+
+ img.gravatar {
+ border: 1px solid #999;
+ margin-bottom: -15px;
+ }
+}
+
+td.main {
+ width: 70%;
+ padding: 1em;
+}
+
+td.sidebar {
+ width: 30%;
+ padding: 1em;
+ vertical-align: top;
+ background: #ffc;
}
@@ -1,2 +1,10 @@
module UsersHelper
+
+ # Return the gravatar of a given user
+ def gravatar_for(user)
+ gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
+ gravatar_url = "http://gravatar.com/avatar/#{gravatar_id}.png"
+ image_tag(gravatar_url, alt: user.name, class: "gravatar")
+ end
+
end
@@ -1,2 +1,15 @@
<% provide :title, @user.name %>
-<h1><%= @user.name %></h1>
+<table class="profile">
+ <tr>
+ <td class="main">
+ <h1>
+ <%= gravatar_for @user %>
+ <%= @user.name %>
+ </h1>
+ </td>
+ <td class="sidebar round">
+ <strong>Name</strong> <%= @user.name %><br />
+ <strong>URL</strong> <%= link_to user_path(@user), @user %>
+ </td>
+ </tr>
+</table>

0 comments on commit 2fca8d7

Please sign in to comment.