From 1f647374a8cdf3bc5c2d29ff8be277b027925c8c Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 30 Mar 2024 16:36:54 -0400 Subject: post comments, refactor post loading, hide load more btn --- web/_views/template/post.php | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'web/_views/template/post.php') diff --git a/web/_views/template/post.php b/web/_views/template/post.php index 40a3c1d..4fbf485 100644 --- a/web/_views/template/post.php +++ b/web/_views/template/post.php @@ -29,25 +29,40 @@
comments(); - ilang('action_load_comments', - class: 'action-load-comments btn btn-line mt', - attrs: array('postId' => $post['id']) - ); + $cdata = $this->comments(); + + $loaded = $cdata['loaded']; + $max = $cdata['max']; + $page_size = $cdata['page_size']; + $total = $post['comment_count']; + + if ($loaded >= $page_size && $page_size < $total) { + ilang('action_load_comments', + class: 'action-load-comments btn btn-line mt', + attrs: array( + 'postId' => $post['id'], + 'loaded' => $loaded, + 'pageSize' => $page_size, + 'commentCount' => $total, + 'commentMax' => $max, + ) + ); + } + ?>
view('template/pfp', array('user' => $user))?> -
+