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

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

    function doDelComment(id) {
        if (confirm("确定要删除这条评论吗？删除后不可恢复")) {
            ajaxGet("#(CPATH)/admin/page/doCommentDel?id=" + id, function () {
                location.href = "#(CPATH)/admin/page/comment";
            }, function (result) {
                alert(result.message);
            })
        }
    }

    function ok() {
        toastr.options.onHidden = function () {
            location.href = "#(CPATH)/admin/page/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/page/doCommentReply">

                        <input type="hidden" name="pid" value="#(comment.id)">
                        <input type="hidden" name="pageId" value="#(comment.pageId)">
                        <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.page.url ??)" target="_blank">《#(comment.page.title ??)》</a> 的评论
                                    </span>
                                </div>
                                <div class="comment-content">
                                    #(comment.content ??)
                                </div>
                                <ul class="list-inline">
                                    <li>
                                        <a href="#(CPATH)/admin/page/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
