From d830376765bf98e50149c5781fdd51a702ee7b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Mon, 5 Dec 2022 16:53:29 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8C=80=EB=8C=93=EA=B8=80=20=ED=8F=BC=20?= =?UTF-8?q?=EC=A0=9C=EC=9E=90=EB=A6=AC=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/js/publicBoard/publicBoard.js | 33 +++++++++++++------ .../publicBoard/notice/noticeViewModal.html | 1 + 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/main/resources/static/js/publicBoard/publicBoard.js b/src/main/resources/static/js/publicBoard/publicBoard.js index 076cad62..140c48ff 100644 --- a/src/main/resources/static/js/publicBoard/publicBoard.js +++ b/src/main/resources/static/js/publicBoard/publicBoard.js @@ -1,4 +1,13 @@ var CrossEditor + +$(function(){ + $("#dateSelectorDiv").datepicker({ + format: "yyyy-mm-dd", + language: "ko", + autoclose: true + }); +}) + $(document).on('click', '#commentSaveBtn', function (){ if(!$("#comment").val()) { alert("댓글을 입력해주세요.") @@ -20,6 +29,7 @@ $(document).on('click', '#commentSaveBtn', function (){ $("#commentDiv").append(html) const parentComment = $("#parentComment"); if(parentComment.val()){ + commentFormReset(); parentComment.val(''); $("#commentFormHome").append($("#commentForm")) } @@ -35,20 +45,16 @@ $(document).on('click', '#commentSaveBtn', function (){ } }) -$(function(){ - $("#dateSelectorDiv").datepicker({ - format: "yyyy-mm-dd", - language: "ko", - autoclose: true - }); -}) - $(document).on('click', '.childCommentBtn', function (){ const childCommentDiv = $(this).parents(".commentRow").find(".childCommentDiv") childCommentDiv.show(); $("#parentComment").val($(this).parents(".commentRow").find(".commentKey").val()); + $("#childFormRemoveBtn").show(); childCommentDiv.empty().append($("#commentForm")) }) +$(document).on('click', '#childFormRemoveBtn', function (){ + commentFormReset(); +}) $(document).on('click', '.deleteCommentBtn', function (){ const commentRow = $(this).parents(".commentRow"); const publicKey = Number(commentRow.find(".publicKey").val()); @@ -166,7 +172,14 @@ function contentCheck(formId){ return flag; } +function commentFormReset(){ + const commentForm = $("#commentForm"); + commentForm[0].reset(); + $("#childFormRemoveBtn").hide(); + $("#parentComment").val(''); + $("#commentFormHome").append(commentForm) +} + function OnInitCompleted(e){ e.editorTarget.SetBodyValue(document.getElementById("content").value); - -} +} \ No newline at end of file diff --git a/src/main/resources/templates/publicBoard/notice/noticeViewModal.html b/src/main/resources/templates/publicBoard/notice/noticeViewModal.html index accb3858..30878bba 100644 --- a/src/main/resources/templates/publicBoard/notice/noticeViewModal.html +++ b/src/main/resources/templates/publicBoard/notice/noticeViewModal.html @@ -82,6 +82,7 @@
+