summaryrefslogtreecommitdiff
path: root/web/_views
diff options
context:
space:
mode:
Diffstat (limited to 'web/_views')
-rw-r--r--web/_views/apps/home/main.php5
-rw-r--r--web/_views/template/comment.php7
-rw-r--r--web/_views/template/post.php31
-rw-r--r--web/_views/template/posts.php23
4 files changed, 52 insertions, 14 deletions
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 @@
</script>
</div>
<?php endif; ?>
- <div id="post-container">
- <?=$this->posts()?>
- </div>
- <?=ilang('action_load_posts', id: 'action-load-posts', class: 'btn btn-line')?>
+ <?php $this->post_controller->index(); ?>
</div>
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 @@
<?php /* Copyright (c) 2024 Freya Murphy */ ?>
<?php /* vi: syntax=php */ ?>
+<?php
+ $format_model = $this->load->model('format');
+?>
<div class="comment row mt">
<?php $this->view('template/pfp', array('user' => $user))?>
<div class="ml col sub-card">
<div class="row">
- <strong><?=$this->main->display_name($user)?></strong>
- <span class="dim ml"><?=$this->main->display_date($comment['date'])?></span>
+ <strong><?=$format_model->name($user)?></strong>
+ <span class="dim ml"><?=$format_model->date($comment['date'])?></span>
</div>
<?=$comment['content']?>
</div>
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"
diff --git a/web/_views/template/posts.php b/web/_views/template/posts.php
new file mode 100644
index 0000000..f57a25f
--- /dev/null
+++ b/web/_views/template/posts.php
@@ -0,0 +1,23 @@
+<div id="post-container">
+<?php
+ $pdata = $this->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,
+ )
+ );
+ }
+?>
+</div>