#@layout()
#define script()
<script src="#(CPATH)/static/components/ckeditor/ckeditor.js"></script>
<script>
    initEditor('editor1', 200);

    function doChangeStatus(id, status) {
        ajaxGet("#(CPATH)/admin/article/doCommentStatusChange?id=" + id + "&status=" + status)
    }

    function doDelComment(id) {
        ajaxGet("#(CPATH)/admin/article/doCommentDel?id=" + id, function () {
            location.href = "#(CPATH)/admin/article/comment";
        }, function (result) {
            alert(result.message);
        })
    }

    function ok() {
        toastr.options.onHidden = function () {
            location.href = "#(CPATH)/admin/article/comment";
        }
        toastr.success('回复成功。');
    }

</script>
#end

#define css()
<style>

    .post {
        margin: 20px 10px;
    }

    .comment-content {
        padding-bottom: 20px;
    }

    .comment-content p {
        display: inline;
    }

</style>
#end

#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
            评论回复
            <small>Comment Reply</small>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">

                    <form class="form-horizontal form-setting autoAjaxSubmit" autocomplete="off"
                          data-ok-function="ok"
                          method="post"
                          action="#(CPATH)/admin/article/doCommentReply">

                        <input type="hidden" name="pid" value="#(comment.id)">
                        <input type="hidden" name="articleId" value="#(comment.articleId)">
                        <input type="hidden" name="pid" value="#(comment.id)">

                        <div class="box-body ">
                            <div class="post">
                                <div class="user-block">
                                    <img class="img-circle img-bordered-sm" src="#(comment.user.avatar ??)">
                                    <span class="username">
                                      <a href="#(CPATH)/admin/user/detail/#(comment.user.id ??)">#(comment.user.nickname ??)</a>
                                    </span>
                                    <span class="description">
                                        #date(comment.created) -  来至对文章
                                        <a href="#(comment.article.url ??)" target="_blank">《#(comment.article.title ??)》</a> 的评论
                                    </span>
                                </div>
                                <div class="comment-content">
                                    #(comment.content ??)
                                </div>
                                <ul class="list-inline">
                                    <li>
                                        <a href="#(CPATH)/admin/article/commentEdit/#(comment.id)"
                                           style="color: #006505">编辑</a>
                                        |
                                        #if(comment.isNormal())
                                        <a href="javascript:;" onclick="doChangeStatus('#(comment.id)','unaudited')"
                                           style="color: #006505">待审核</a> |
                                        #else
                                        <a href="javascript:;" onclick="doChangeStatus('#(comment.id)','normal')"
                                           style="color: #006505">设为正常</a> |
                                        #end
                                        <a href="javascript:;" onclick="doChangeStatus('#(comment.id)','trash')"
                                           style="color: #a00">垃圾箱</a> |
                                        <a href="javascript:;" onclick="doDelComment('#(comment.id)')"
                                           style="color: #a00">永久删除</a>
                                    </li>
                                </ul>

                                <div class="">
                                    <textarea id="editor1" name="content"
                                              style="height: 200px;width: 100%;background-color: white"></textarea>
                                </div>

                            </div>

                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <div class="col-sm-11 submit-block" style="padding-left: 20px">
                                <div class="box-submit">
                                    <button type="submit" class="btn btn-primary"> 回 复</button>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </div>

    </section>

</div>
#end
