From 9470a284bab85da6067d6d337a4a81dcf9213d62 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Tue, 16 Sep 2008 18:50:40 -0300 Subject: [PATCH] ActionItem694: "this article tags:" appears even if there are no tags --- app/views/content_viewer/view_page.rhtml | 10 ++++++---- test/functional/content_viewer_controller_test.rb | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index b954212..df32fad 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -45,10 +45,12 @@ <% end %> -
- <%= _("This article's tags:") %> - <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tag', :id => t.name ) }.join("\n") %> -
+<% if !@page.tags.empty? %> +
+ <%= _("This article's tags:") %> + <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tag', :id => t.name ) }.join("\n") %> +
+<% end %> <% if @page.parent && !@page.parent.path.blank? %>
diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index d9d3ea5..d971c86 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -273,6 +273,14 @@ class ContentViewerControllerTest < Test::Unit::TestCase assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } end + should "not display current article's tags" do + page = profile.articles.create!(:name => 'myarticle', :body => 'test article') + + get :view_page, :profile => profile.identifier, :page => [ 'myarticle' ] + assert_no_tag :tag => 'div', :attributes => { :id => 'article-tags' } + assert_no_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } + end + should 'not display forbidden articles' do profile.articles.create!(:name => 'test') profile.update_attributes!(:public_content => false) -- libgit2 0.21.2