summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-02-29 12:23:00 -0600
committerHombreLaser <sebastian-440@live.com>2024-02-29 12:23:00 -0600
commit92c58b56a94d4cd3484eb9f5e6393a67392700df (patch)
tree33dbce95c5d409bcf6798c81203fed8a0f8b98f1
parentb918a93f6854ced395e313dae0501b9267d6da30 (diff)
Add more replies button
-rw-r--r--static/js/controllers/comments_controller.js1
-rw-r--r--templates/macros/pagination.jinja6
-rw-r--r--templates/replies/index.jinja3
3 files changed, 10 insertions, 0 deletions
diff --git a/static/js/controllers/comments_controller.js b/static/js/controllers/comments_controller.js
index 5f454df..458ff43 100644
--- a/static/js/controllers/comments_controller.js
+++ b/static/js/controllers/comments_controller.js
@@ -52,6 +52,7 @@ export class CommentsController extends BaseController {
async submit(event) {
var form = new FormData(event.target);
+ form.set('content', form.get('content').trim());
form.append("domain", `${window.location.protocol}//${window.location.host}`);
super.submit(event, `${this.comments_server_host}/api/comments?path=${this.post}`, form);
diff --git a/templates/macros/pagination.jinja b/templates/macros/pagination.jinja
index b53c0eb..04aa9cd 100644
--- a/templates/macros/pagination.jinja
+++ b/templates/macros/pagination.jinja
@@ -15,4 +15,10 @@
{% endif %}
{% endfor %}
</div>
+{% endmacro %}
+
+{% macro render_reply_pagination(pagination, comment_id) %}
+ {% if pagination.items and pagination.has_next %}
+ <button id="more-replies-{{ comment_id }}" class="reply-paginator-button">More replies</button>
+ {% endif %}
{% endmacro %} \ No newline at end of file
diff --git a/templates/replies/index.jinja b/templates/replies/index.jinja
index c1fc6ea..eb99464 100644
--- a/templates/replies/index.jinja
+++ b/templates/replies/index.jinja
@@ -1,3 +1,5 @@
+{% import 'macros/pagination.jinja' as pagination %}
+
<div id="replies-section-{{comment.id}}" class="replies-section">
{% for reply in page.items %}
<div id="reply-{{reply.id}}" class="comment">
@@ -18,4 +20,5 @@
</textarea>
</div>
{% endfor %}
+ {{ pagination.render_reply_pagination(page, comment.id) }}
</div>