Commit 2141bb048d25c73242e2de2478720f122e42add5
Exists in
master
and in
29 other branches
Merge commit '8dbebef'
Showing
3 changed files
with
13 additions
and
2 deletions
Show diff stats
app/helpers/content_viewer_helper.rb
... | ... | @@ -17,7 +17,7 @@ module ContentViewerHelper |
17 | 17 | title = article.display_title if article.kind_of?(UploadedFile) && article.image? |
18 | 18 | title = article.title if title.blank? |
19 | 19 | title = content_tag('h1', h(title), :class => 'title') |
20 | - if article.belongs_to_blog? | |
20 | + if article.belongs_to_blog? || article.belongs_to_forum? | |
21 | 21 | unless args[:no_link] |
22 | 22 | title = content_tag('h1', link_to(article.name, article.url), :class => 'title') |
23 | 23 | end | ... | ... |
app/models/article.rb
... | ... | @@ -310,6 +310,10 @@ class Article < ActiveRecord::Base |
310 | 310 | def belongs_to_blog? |
311 | 311 | self.parent and self.parent.blog? |
312 | 312 | end |
313 | + | |
314 | + def belongs_to_forum? | |
315 | + self.parent and self.parent.forum? | |
316 | + end | |
313 | 317 | |
314 | 318 | def info_from_last_update |
315 | 319 | last_comment = comments.last | ... | ... |
test/unit/content_viewer_helper_test.rb
... | ... | @@ -18,8 +18,15 @@ class ContentViewerHelperTest < ActiveSupport::TestCase |
18 | 18 | result = article_title(post) |
19 | 19 | assert_tag_in_string result, :tag => 'span', :content => show_date(post.published_at) |
20 | 20 | end |
21 | + | |
22 | + should 'display published-at for forum posts' do | |
23 | + forum = fast_create(Forum, :name => 'Forum test', :profile_id => profile.id) | |
24 | + post = TextileArticle.create!(:name => 'post test', :profile => profile, :parent => forum) | |
25 | + result = article_title(post) | |
26 | + assert_tag_in_string result, :tag => 'span', :content => show_date(post.published_at) | |
27 | + end | |
21 | 28 | |
22 | - should 'not display published-at for non-blog posts' do | |
29 | + should 'not display published-at for non-blog and non-forum posts' do | |
23 | 30 | article = TextileArticle.create!(:name => 'article for test', :profile => profile) |
24 | 31 | result = article_title(article) |
25 | 32 | assert_no_match /<span class="date">#{show_date(article.published_at)}<\/span><span class="author">, by .*#{profile.identifier}/, result | ... | ... |