Files
growstuff/app/views/posts/_summary.html.haml
2016-06-02 14:39:56 +00:00

26 lines
906 B
Plaintext

- howmany ||= 100
- if posts.size > 0
%table.table.table-striped
%tr
%th Subject
%th.hidden-xs Posted by
%th Most recent activity
%th.hidden-xs Comments
- posts.recently_active[0..howmany-1].each do |post|
- cache post do
%tr
%td
= link_to truncate(strip_tags(post.subject), :length => 40, :separator => ' '), post
%td.hidden-xs
=link_to post.author, post.author
%td
- if post.updated_at > post.recent_activity
= post.updated_at.to_date.to_formatted_s(:short)
- else
= post.recent_activity.to_date.to_formatted_s(:short)
// once the site gets more active, can change this to include time as well
// can't make it relative (distance_of_time_in_words) as it's cached
%td.hidden-xs
= post.comments.size.to_s