diff options
-rw-r--r-- | static/js/controllers/comments_controller.js | 1 | ||||
-rw-r--r-- | templates/macros/pagination.jinja | 6 | ||||
-rw-r--r-- | templates/replies/index.jinja | 3 |
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> |