Commit 9470a284bab85da6067d6d337a4a81dcf9213d62
1 parent
a8a2a647
Exists in
master
and in
29 other branches
ActionItem694: "this article tags:" appears even if there are no tags
Showing
2 changed files
with
14 additions
and
4 deletions
Show diff stats
app/views/content_viewer/view_page.rhtml
@@ -45,10 +45,12 @@ | @@ -45,10 +45,12 @@ | ||
45 | <% end %> | 45 | <% end %> |
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | -<div id="article-tags"> | ||
49 | - <%= _("This article's tags:") %> | ||
50 | - <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tag', :id => t.name ) }.join("\n") %> | ||
51 | -</div> | 48 | +<% if !@page.tags.empty? %> |
49 | + <div id="article-tags"> | ||
50 | + <%= _("This article's tags:") %> | ||
51 | + <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tag', :id => t.name ) }.join("\n") %> | ||
52 | + </div> | ||
53 | +<% end %> | ||
52 | 54 | ||
53 | <% if @page.parent && !@page.parent.path.blank? %> | 55 | <% if @page.parent && !@page.parent.path.blank? %> |
54 | <div id="article-parent"> | 56 | <div id="article-parent"> |
test/functional/content_viewer_controller_test.rb
@@ -273,6 +273,14 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -273,6 +273,14 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
273 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } | 273 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } |
274 | end | 274 | end |
275 | 275 | ||
276 | + should "not display current article's tags" do | ||
277 | + page = profile.articles.create!(:name => 'myarticle', :body => 'test article') | ||
278 | + | ||
279 | + get :view_page, :profile => profile.identifier, :page => [ 'myarticle' ] | ||
280 | + assert_no_tag :tag => 'div', :attributes => { :id => 'article-tags' } | ||
281 | + assert_no_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } | ||
282 | + end | ||
283 | + | ||
276 | should 'not display forbidden articles' do | 284 | should 'not display forbidden articles' do |
277 | profile.articles.create!(:name => 'test') | 285 | profile.articles.create!(:name => 'test') |
278 | profile.update_attributes!(:public_content => false) | 286 | profile.update_attributes!(:public_content => false) |