Don't show comments section if zero comments and no postbox

git-svn-id: file:///home/shish/svn/shimmie2/trunk@578 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-10-27 23:32:39 +00:00
parent 5bf7298e0a
commit 501ecb1201

View File

@ -37,7 +37,7 @@ class CommentListTheme extends Themelet {
} }
/* /*
* * Show comments for an image
*/ */
public function display_comments($page, $comments, $postbox, $image_id) { public function display_comments($page, $comments, $postbox, $image_id) {
if($postbox) { if($postbox) {
@ -46,13 +46,16 @@ class CommentListTheme extends Themelet {
$this->build_postbox($image_id), "main", 30)); $this->build_postbox($image_id), "main", 30));
} }
else { else {
if(count($comments) > 0) {
$page->add_block(new Block("Comments", $page->add_block(new Block("Comments",
$this->comments_to_html($comments), "main", 30)); $this->comments_to_html($comments), "main", 30));
} }
} }
}
/* /*
* * Add a block with thumbnail and comments, as part of the comment
* list page
*/ */
public function add_comment_list($page, $image, $comments, $position, $with_postbox) { public function add_comment_list($page, $image, $comments, $position, $with_postbox) {
$html = "<div style='text-align: left'>"; $html = "<div style='text-align: left'>";
@ -63,7 +66,8 @@ class CommentListTheme extends Themelet {
$html .= "<div style='clear:both;'>".($this->build_postbox($image->id))."</div>"; $html .= "<div style='clear:both;'>".($this->build_postbox($image->id))."</div>";
} }
else { else {
$html .= "<div style='clear:both;'><p><small>You need to create an account before you can comment</small></p></div>"; // $html .= "<div style='clear:both;'><p><small>You need to create an account before you can comment</small></p></div>";
$html .= "<div style='clear:both;'><p>&nbsp;</p></div>";
} }
$page->add_block(new Block("{$image->id}: ".($image->get_tag_list()), $html, "main", $position)); $page->add_block(new Block("{$image->id}: ".($image->get_tag_list()), $html, "main", $position));