Move back to image link helper, but static

This commit is contained in:
Raphael 2010-11-30 12:46:00 -08:00
parent 7bce44ef28
commit 93bbfd19d2
3 changed files with 15 additions and 10 deletions

View file

@ -96,7 +96,13 @@ module ApplicationHelper
end end
def person_image_tag(person) def person_image_tag(person)
image_tag image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id "<img alt='#{person.real_name}' class='avatar' data-person_id='#{person.id}' src='#{image_or_default(person)}' title='#{person.real_name}'>".html_safe
end
def person_link(person)
"<a href='/people/#{person.id}'>
#{person.real_name}
</a>".html_safe
end end
def image_or_default(person) def image_or_default(person)
@ -114,7 +120,9 @@ module ApplicationHelper
if opts[:to] == :photos if opts[:to] == :photos
link_to person_image_tag(person), person_photos_path(person) link_to person_image_tag(person), person_photos_path(person)
else else
link_to person_image_tag(person), person_path(person) "<a href='/people/#{person.id}'>
#{person_image_tag(person)}
</a>".html_safe
end end
end end

View file

@ -4,11 +4,10 @@
- comment = hash[:comment] - comment = hash[:comment]
- person = hash[:person] - person = hash[:person]
%li.comment{:data=>{:guid=>comment.id}} %li.comment{:data=>{:guid=>comment.id}}
%a{:href => "/people/#{person.id}"} =person_image_link(person)
%img{:src => image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id}
.content .content
.from .from
%a{:href => "/people/#{person.id}"}=person.real_name =person_link(person)
= markdownify(comment.text, :youtube_maps => comment[:youtube_titles]) = markdownify(comment.text, :youtube_maps => comment[:youtube_titles])
%div.time %div.time
= comment.created_at ? "#{time_ago_in_words(comment.created_at)} #{t('ago')}" : time_ago_in_words(Time.now) = comment.created_at ? "#{time_ago_in_words(comment.created_at)} #{t('ago')}" : time_ago_in_words(Time.now)

View file

@ -3,12 +3,10 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
%li.message{:data=>{:guid=>post.id}} %li.message{:data=>{:guid=>post.id}}
%a{:href => "/people/#{person.id}"} =person_image_link(person)
%img{:src => image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id}
.content .content
.from .from
%a{:href => "/people/#{person.id}"}=person.real_name =person_link(person)
- if person.owner_id == current_user.id - if person.owner_id == current_user.id
.aspect .aspect
@ -22,7 +20,7 @@
.right .right
- reshare_aspects = aspects_without_post(aspects, post) - reshare_aspects = aspects_without_post(aspects, post)
- unless reshare_aspects.empty? - unless reshare_aspects.empty?
= render 'shared/reshare', :current_user => current_user, :aspects => reshare_aspects, :post => post = render 'shared/reshare', :aspects => reshare_aspects, :post => post
= link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete" = link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= render 'status_messages/status_message', :post => post, :photos => photos = render 'status_messages/status_message', :post => post, :photos => photos