summaryrefslogtreecommitdiff
path: root/web/_views/template/post.php
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-03-30 16:36:54 -0400
committerFreya Murphy <freya@freyacat.org>2024-03-30 16:36:54 -0400
commit1f647374a8cdf3bc5c2d29ff8be277b027925c8c (patch)
tree9fdf42d250edb941de13ecd1aab9185ba2b30b00 /web/_views/template/post.php
parentrename views to _views (diff)
downloadxssbook2-1f647374a8cdf3bc5c2d29ff8be277b027925c8c.tar.gz
xssbook2-1f647374a8cdf3bc5c2d29ff8be277b027925c8c.tar.bz2
xssbook2-1f647374a8cdf3bc5c2d29ff8be277b027925c8c.zip
post comments, refactor post loading, hide load more btn
Diffstat (limited to 'web/_views/template/post.php')
-rw-r--r--web/_views/template/post.php31
1 files changed, 23 insertions, 8 deletions
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 @@
<div class="col comments">
<?php
$_GET['id'] = $post['id'];
- $this->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,
+ )
+ );
+ }
+
?>
</div>
<?php if ($self): ?>
<div class="row grow mt">
<?php $this->view('template/pfp', array('user' => $user))?>
- <form class="ml">
+ <form class="ml action-new-comment-form">
<input
type="hidden"
name="id"
value="<?=$post['id']?>"
>
<input
- id="new-comment-<?=$post['id']?>"
- class="input"
+ class="action-new-comment input"
+ postId="<?=$post['id']?>"
autocomplete="off"
type="text"
name="text"