w

게시판 댓글에 답변 달기

게시판 댓글에 답변을 달려고 답변을 눌렀다가 답변을 안쓰고

원글에 답변을 달려고 하면 댓글입력폼이 원상복구 되지 않아 새로고침을 해야 하는 번거로움이 있어서

view_comment.skin.php 파일을 좀 수정했습니다.

 

수정된 게시판 테스트 주소

http://work.wwiz.kr/free

 

//게시판 댓글 답변 수정 버튼 수정-->

--data-cmtid, data-cmtkind 추가

<?php if ($list[$i]['is_reply']) { ?><span class="cmt-vc-icon cmt-icon-write" data-cmtid="<?php echo $comment_id ?>" data-cmtkind="c">답변</span><?php } ?>
                <?php if ($list[$i]['is_edit']) { ?><span class="cmt-vc-icon cmt-icon-write" data-cmtid="<?php echo $comment_id ?>" data-cmtkind="cu">수정</span><?php } ?>

 

댓글목록 부분에

<div id="cf_<?php echo $comment_id?>"></div> <--추가된 부분
        <input type="hidden" value="<?php echo strstr($list[$i]['wr_option'],"secret") ?>" id="secret_comment_<?php echo $comment_id ?>">
        <textarea id="save_comment_<?php echo $comment_id ?>" style="display:none"><?php echo get_text($list[$i]['content1'], 0) ?></textarea>

 

<--js 스크립트 추가-->

$('.cmt-icon-write').on("click",function(){
        var $this = $(this),
            cmtid = $this.data('cmtid'),
            work = $this.data('cmtkind'),
            wf = $('#bo_vc_w');
        
        if($this.hasClass('cmt-icon-open') === true) {
            $('#w').val('c');
            $('#comment_id').val('');
            document.getElementById('wr_content').value = '';
            document.getElementById('wr_secret').checked = false;
            $this.removeClass('cmt-icon-open');
            $('#bo_vc').after($(wf));
            return false;
        }

        if(work == 'cu') {
            document.getElementById('wr_content').value = document.getElementById('save_comment_' + cmtid).value;
            if (typeof char_count != 'undefined') {
                check_byte('wr_content', 'char_count');
            }
            if (document.getElementById('secret_comment_'+cmtid).value) {
                document.getElementById('wr_secret').checked = true;
            } else {
                document.getElementById('wr_secret').checked = false;
            }
        } else {
            document.getElementById('wr_content').value = '';
            document.getElementById('wr_secret').checked = false;
        }
        
        $('.cmt-icon-write').removeClass('cmt-icon-open');
        $this.addClass('cmt-icon-open');
        $('#w').val(work);
        $('#comment_id').val(cmtid);
        $('#cf_'+cmtid).append($(wf));
    });

|

댓글 5개

댓글답변달기 취소의 경우엔
https://ye-ah.net/coding/3
간단하게 그누보드 함수인 comment_box를 통해 취소할수있습니다
감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
20-10-20 조회 6,895
20-10-14 조회 9,347
20-10-13 조회 6,415
20-10-11 조회 7,853
20-10-11 조회 6,799
20-10-08 조회 8,156
20-10-08 조회 6,597
20-10-07 조회 8,106
20-10-04 조회 7,969
20-09-28 조회 8,270
20-09-26 조회 9,090
20-09-25 조회 1.1만
20-09-24 조회 6,967
20-09-22 조회 9,454
20-09-21 조회 6,866
20-09-17 조회 6,370
20-09-16 조회 7,211
20-09-16 조회 7,233
20-09-13 조회 9,206
20-09-11 조회 8,205
20-09-10 조회 7,727
20-09-10 조회 6,240
20-09-08 조회 6,159
20-09-08 조회 7,707
20-09-08 조회 6,166
20-09-07 조회 8,202
20-09-05 조회 9,861
20-09-02 조회 8,234
20-08-31 조회 8,617
20-08-29 조회 9,551