<script>

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

    function doDelComment(id) {
        if (confirm("确定要删除这条评论吗？删除后不可恢复")) {
            ajaxGet("#(CPATH)/admin/article/doCommentDel?id=" + id);
        }
    }

</script>
<style>
    .comment-content {
        padding-bottom: 20px;
    }

    .comment-content p {
        display: inline;
    }
</style>

<div class="col-md-6 col-sm-6 col-xs-12">
    <div class="box box-dashboard">
        <div class="box-header with-border">
            <h3 class="box-title">最新文章</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body no-padding">
            <table class="table table-striped">
                <tbody>
                #for(article : articles)
                <tr>
                    <td style="width: 130px">#date(article.created ??)</td>
                    <td><a href="#(article.url ??)" target="_blank">#(article.title ??)</a></td>
                </tr>
                #end
                </tbody>
            </table>
        </div>
    </div>
</div>

<div class="col-md-6 col-sm-6 col-xs-12">
    <div class="box box-dashboard">
        <div class="box-header with-border">
            <h3 class="box-title">最新评论</h3>
        </div>
        <div class="box-body no-padding">
            <table class="table table-striped">
                <tbody>
                #for(comment : articleComments)
                <tr>
                    <td>
                        <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.author ??)</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 ??)
                                #if(!comment.isNormal()) <strong style="color: #000">（#(comment.statusString)）</strong>
                                #end
                            </div>
                            <ul class="list-inline">
                                <li>
                                    <a href="#(CPATH)/admin/article/commentReply/#(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>
                    </td>
                </tr>
                #end
                </tbody>
            </table>
        </div>

    </div>
</div>