<!DOCTYPE html>
<html
        xmlns:th="http://www.thymeleaf.org"
        xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
        xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
        layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
    <script type="text/javascript" th:src="@{/js/blog.js}"></script>
    <link th:href="@{/css/blog.css}" rel="stylesheet" />

</th:block>
<th:block layout:fragment="content" id="content">
    <div id="main_layer">
        <th:block sec:authorize="isAnonymous()">
            <h1>권한이 없는 뎁쇼?!</h1>
        </th:block>
        <th:block sec:authorize="isAuthenticated()">
            <div class="post_layer" id="posts" th:each="posts, postsStat : ${chunkedPosts}">
                <div class="post_layer" th:class="${#strings.append(rowKey, postsStat.index)}" th:each="post, postStat : ${posts}">
                    <div class="post_item"
                         th:if="${post.id != null and post.id != ''}"
                         onclick="goToEditor(this)"
                         th:attr="data-post-id=${post.id}">
                        <span id="postTitle" class="post_attr" th:text="${post.title}"></span>
                        <div id="content" class="post_attr content" th:attr="data=${post.content}"></div>
                        <span id="writeDate" class="post_attr" th:text="${#dates.format(post.writeTime, 'yyyy.MM.dd HH:mm:ss')}"></span>
                        <span id="postId" class="post_attr" th:text="${post.id}"></span>
                    </div>
                </div>
            </div>
        </th:block>
    </div>
</th:block>
</html>
