module BoardHelper
def discussion_in_css(posts, depth=1, output="", last_post=false)
post = posts.first
responses = posts[1..-1]
highlight = (post.id.to_s == @highlight) ? " highlight" : ""
if @last_post_id && @last_post_id.to_i-@new_posts < post.id
newpost = last_post ? " newlastpost" : " newpost"
else
newpost = ''
end
output << "
"
if depth < 10
output << link_to('↪',
{:action => "reply",
:id => post},
{:class => 'newthread',
:title => 'Respond on the right'})
end
if post.sage == "1"
output << "◈"
end
if post.author?
output << "#{post.author}"
if post.tripcode?
output << "▪#{post.tripcode}" # 25c6
end
output << ""
end
output << post.to_html
if depth > 1 && last_post
output << link_to('↓',
{:action => "reply",
:id => post.parent},
{:class => 'reply',
:title => 'Respond below'})
end
output << "
"
unless responses.empty?
output << ""
responses.each_with_index { |r, i|
discussion_in_css r, depth+1, output, i == responses.size-1
}
output << "
"
end
output
end
def format_timestamp(time)
time.strftime("%d%b%Y %H:%M:%S").downcase
end
end