diff options
author | HombreLaser <sebastian-440@live.com> | 2024-02-23 17:18:36 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2024-02-23 17:18:36 -0600 |
commit | d218bdaac8e5c90a2bd7b7bf428ed09a726102c3 (patch) | |
tree | 50698e847fc8993fb2b42574c1e0eaced317fc23 | |
parent | d5d73505832bb39cf8e7fa5a49ff8e3d56690d71 (diff) |
Add reply form hiding
-rw-r--r-- | static/js/controllers/replies_controller.js | 8 |
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()"); } |