From b621535285b8d00974c9bd172687c196d133a41f Mon Sep 17 00:00:00 2001 From: Caio SBA Date: Wed, 26 Jan 2011 01:53:19 -0300 Subject: [PATCH] Show "post a comment" top button only if there is more than one comment --- app/controllers/public/content_viewer_controller.rb | 1 + app/views/content_viewer/view_page.rhtml | 2 +- features/comment.feature | 16 +++++++++------- test/functional/content_viewer_controller_test.rb | 28 ++++++++++++++++++++++++++-- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index 47dec71..89041bd 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -100,6 +100,7 @@ class ContentViewerController < ApplicationController end @comments = @page.comments(true).as_thread + @comments_count = @page.comments.count if params[:slideshow] render :action => 'slideshow', :layout => 'slideshow' end diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index dfea761..7b8df40 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -125,7 +125,7 @@

> <%= number_of_comments(@page) %>

- <% if @comments.size > 0 %> + <% if @comments_count > 1 %>

<%= _('Post a comment') %>

<% end %>