Skip to content

Commit

Permalink
Merge pull request hotsh#411 from LindseyB/master
Browse files Browse the repository at this point in the history
Updated avatar asset fix to use a helper
  • Loading branch information
steveklabnik committed Oct 16, 2011
2 parents 67a3fe6 + 01c578f commit bf15294
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
7 changes: 7 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
module ApplicationHelper
def avatar_for(author)
if author.avatar_url.eql? Author::DEFAULT_AVATAR
asset_path(author.avatar_url)
else
author.avatar_url
end
end
end
2 changes: 1 addition & 1 deletion app/views/shared/sidebar/_profile.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#current_user_block.vcard.block
.avatar
%a{:href=>"/users/#{current_user.username}"}
%img.photo{:alt => "avatar", :src => current_user.author.avatar_url}/
%img.photo{:alt => "avatar", :src => avatar_for(current_user.author)}/
.user-info
%h4.name
= current_user.author.display_name
Expand Down
5 changes: 1 addition & 4 deletions app/views/updates/_detail.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
.byline
%a.author{:href => "/users/#{update.author.username}"}
.avatar
- if update.author.avatar_url.eql? Author::DEFAULT_AVATAR
%img{:alt => "avatar", :src => asset_path(update.author.avatar_url)}/
- else
%img{:alt => "avatar", :src => update.author.avatar_url}/
%img{:alt => "avatar", :src => avatar_for(update.author)}/
= update.author.username
.update-text
.content
Expand Down
5 changes: 1 addition & 4 deletions app/views/updates/_list.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
.author.vcard
.avatar
%a.url{:href => update.author.url}
- if update.author.avatar_url.eql? Author::DEFAULT_AVATAR
%img.photo{:alt => "avatar", :src => asset_path(update.author.avatar_url)}/
- else
%img.photo{:alt => "avatar", :src => update.author.avatar_url}/
%img.photo{:alt => "avatar", :src => avatar_for(update.author)}/
%span.fn
%a.url{:href => update.author.url}
= update.author.display_name
Expand Down

0 comments on commit bf15294

Please sign in to comment.