summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-03-04 12:50:17 -0600
committerHombreLaser <sebastian-440@live.com>2024-03-04 12:50:17 -0600
commit652934a93c92ae1f1f1df6fa577a1cb78f5b78ff (patch)
treef4ca2d5f52a1faf16c9eaf4da3b8241bf50a405d
parentae390aabc9a19e680531241e028877c7ab9a3631 (diff)
Some improvements to the replies javascriptHEADmaster
-rw-r--r--static/js/controllers/replies_controller.js11
-rw-r--r--templates/replies/index.jinja2
2 files changed, 10 insertions, 3 deletions
diff --git a/static/js/controllers/replies_controller.js b/static/js/controllers/replies_controller.js
index 119062c..45dad24 100644
--- a/static/js/controllers/replies_controller.js
+++ b/static/js/controllers/replies_controller.js
@@ -12,6 +12,10 @@ export class RepliesController extends BaseController {
async init() {
this.comment_id = 0;
this.reply_form = await this.getReplyForm();
+ this.initializeButtons();
+ }
+
+ initializeButtons() {
this.listenButtons("replies-button", this.renderReplies.bind(this));
this.listenButtons("new-reply-button", this.showReplyForm.bind(this));
}
@@ -62,13 +66,16 @@ export class RepliesController extends BaseController {
renderSubmitResponse(response_document) {
const comment = document.getElementById(`comment-${this.comment_id}`);
- const present_replies = comment.querySelector(".replies-section");
+ const comment_replies = comment.querySelector(".comment-replies");
+ const present_replies = comment_replies.querySelector(".replies-section");
const new_comment_replies = this.htmlFromResponse(response_document).getElementById(`replies-section-${this.comment_id}`)
if(present_replies != null)
present_replies.replaceWith(new_comment_replies);
else
- comment.appendChild(new_comment_replies);
+ comment_replies.appendChild(new_comment_replies);
+
+ this.initializeButtons();
}
setCommentId(replies_section) {
diff --git a/templates/replies/index.jinja b/templates/replies/index.jinja
index eb99464..a3fbb0e 100644
--- a/templates/replies/index.jinja
+++ b/templates/replies/index.jinja
@@ -6,7 +6,7 @@
<section class="comment-meta">
<div class="author">
{% if reply.author is eq('') %}
- Anonymous said:
+ Anonymous replied:
{% else %}
{{ reply.author }} replied:
{% endif %}