summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-02-23 17:18:36 -0600
committerHombreLaser <sebastian-440@live.com>2024-02-23 17:18:36 -0600
commitd218bdaac8e5c90a2bd7b7bf428ed09a726102c3 (patch)
tree50698e847fc8993fb2b42574c1e0eaced317fc23
parentd5d73505832bb39cf8e7fa5a49ff8e3d56690d71 (diff)
Add reply form hiding
-rw-r--r--static/js/controllers/replies_controller.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/static/js/controllers/replies_controller.js b/static/js/controllers/replies_controller.js
index af0f2ec..5e67057 100644
--- a/static/js/controllers/replies_controller.js
+++ b/static/js/controllers/replies_controller.js
@@ -22,17 +22,19 @@ export class RepliesController extends BaseController {
showReplyForm(event) {
const replies_section = event.target.parentElement.parentElement.childNodes[3];
+ const form = replies_section.querySelector(".reply-form");
- if(replies_section.querySelector(".reply-form") == null)
+ if(form == null)
replies_section.appendChild(this.reply_form);
- /*else hide*/
+ else
+ form.remove();
}
showReplies(event) {
/* The div to contain the comment's replies. From the element id
we can get the comment's id. */
const replies_section = event.target.parentElement.parentElement.childNodes[3];
- const comment_id = /\d/.exec(replies_section.id)[0]
+ const comment_id = /\d/.exec(replies_section.id)[0];
console.log("You're in showReplies()");
}