From fae9aee4251b929d905fd21975b6c52093107286 Mon Sep 17 00:00:00 2001 From: Pistos Date: Sat, 15 Oct 2011 14:47:09 -0400 Subject: [PATCH] Fix specs. --- app/helpers/comments_helper.rb | 4 ++++ app/views/comments/_comments.html.haml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 13f788c13..492b38eae 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -42,4 +42,8 @@ module CommentsHelper false end end + + def all_comments? + defined?(request_parameters) && !! params['all_comments'] + end end diff --git a/app/views/comments/_comments.html.haml b/app/views/comments/_comments.html.haml index daf379a32..f8cfa7e30 100644 --- a/app/views/comments/_comments.html.haml +++ b/app/views/comments/_comments.html.haml @@ -2,13 +2,13 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. .comment_stream - - unless comments_expanded || params['all_comments'] + - unless comments_expanded || all_comments? %ul.show_comments{:class => ("hidden" if post.comments.size <= 3)} %li = comment_toggle( post) %ul.comments{:class => ('loaded' if post.comments.size <= 3)} - -if post.comments.size > 3 && !comments_expanded && ! params['all_comments'] + -if post.comments.size > 3 && !comments_expanded && ! all_comments? = render :partial => 'comments/comment', :collection => post.comments.last(3), :locals => {:post => post} -else = render :partial => 'comments/comment', :collection => post.comments, :locals => {:post => post}