comment_helper.rb
917 Bytes
module CommentHelper
def article_title(article, args = {})
title = article.display_title if article.kind_of?(UploadedFile) && article.image?
title = article.title if title.blank?
title = content_tag('h1', h(title), :class => 'title')
if article.belongs_to_blog?
unless args[:no_link]
title = content_tag('h1', link_to(article.name, article.url), :class => 'title')
end
comments = ''
unless args[:no_comments] || !article.accept_comments
comments = (" - %s") % link_to_comments(article)
end
title << content_tag('span',
content_tag('span', show_date(article.published_at), :class => 'date') +
content_tag('span', [_(", by %s") % link_to(article.author_name, article.author_url)], :class => 'author') +
content_tag('span', comments, :class => 'comments'),
:class => 'created-at'
)
end
title
end
end