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/apps/home/main.php | 5 +---- web/_views/template/comment.php | 7 +++++-- web/_views/template/post.php | 31 +++++++++++++++++++++++-------- web/_views/template/posts.php | 23 +++++++++++++++++++++++ 4 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 web/_views/template/posts.php (limited to 'web/_views') diff --git a/web/_views/apps/home/main.php b/web/_views/apps/home/main.php index b1c1efc..5cfdf8c 100644 --- a/web/_views/apps/home/main.php +++ b/web/_views/apps/home/main.php @@ -23,8 +23,5 @@ -
- posts()?> -
- + post_controller->index(); ?> diff --git a/web/_views/template/comment.php b/web/_views/template/comment.php index 943f232..20032b2 100644 --- a/web/_views/template/comment.php +++ b/web/_views/template/comment.php @@ -1,11 +1,14 @@ +load->model('format'); +?>
view('template/pfp', array('user' => $user))?>
- main->display_name($user)?> - main->display_date($comment['date'])?> + name($user)?> + date($comment['date'])?>
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))?> -
+ +posts(); + + $loaded = $pdata['loaded']; + $page_size = $pdata['page_size']; + $total = $pdata['total']; + $max = $pdata['max']; + + if ($loaded >= $page_size && $page_size < $total) { + ilang('action_load_posts', + id: 'action-load-posts', + class: 'btn btn-line mb', + attrs: array( + 'loaded' => $loaded, + 'pageSize' => $page_size, + 'postCount' => $total, + 'postMax' => $max, + ) + ); + } +?> +
-- cgit v1.2.3-freya