Permalink
Browse files

alternate image for missing image

  • Loading branch information...
1 parent a5d4e8a commit cdfc260f4991e1fc797d2734d33de2d6a08d3938 @drnic committed Apr 21, 2011
View
5 app/helpers/users_helper.rb
@@ -0,0 +1,5 @@
+module UsersHelper
+ def user_image(user)
+ user.image_url.blank? ? '/images/unknown-person.png' : user.image_url
+ end
+end
View
3 app/views/home/index.html.haml
@@ -28,6 +28,7 @@
%ul.current-members
- @members.each do |user|
%li{:class => (user == current_user ? 'current-user' : 'other-user')}
- = image_tag user.image_url, :class => "user-image"
+ - image = user_image(user)
+ = image_tag image, :class => "user-image"
= user.name
View
2 app/views/layouts/_login.html.erb
@@ -1,5 +1,5 @@
<% if current_user %>
- <%= image_tag current_user.image_url, :class => "user-image" %>
+ <%= image_tag user_image(current_user), :class => "user-image" %>
<%= current_user.name %> |
<%= link_to "Sign Out", signout_path %>
<% else %>
View
BIN public/images/unknown-person.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cdfc260

Please sign in to comment.