<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{blog/sketch/header::head-fragment}"></head>
<body>
    <div class="side-click-mask"></div>
    <div class="move-block">
        <div th:replace="~{blog/sketch/header::header}"></div>
        <div th:replace="~{blog/sketch/header::burger}"></div>
        <div th:replace="~{blog/sketch/header::sidebar-container}"></div>
        <div>
            <main>
                <article class="post">
                        <div class="archives" th:with="
                        isLogin = ${SessionUtils.isLogin(request)},
                        passCookie = ${CookieUtils.getCookie(request, CookieUtils.PASSWORD_COOKIE)},
                        posts=${@postService.getLatestPosts(null)}">
                            
                            <header th:if="${posts == null || posts.size() == 0}">
                                <div class="post-content">啊这，这个人还没有任何公开文章<br/>Oops, there's no any released post yet.
                                </div>
                            </header>
                            <th:block th:each="post, i : ${posts}">
                                <th:block th:with="postYear=${post.createTime.year}">
                                    <th:block th:if="${i.first or postYear != posts[i.index - 1].createTime.year}" >
                                        <div class="year" th:with="year=${postYear}" th:text="${postYear}"></div>
                                        <th:block th:utext="'<ul>'"></th:block>
                                    </th:block>
                                            <li>
                                                <table><tbody><tr><td>
                                                <span th:text="${#temporals.format(post.createTime, 'MM/dd')}"></span></td>
                                                <td><a th:href="${post.link}">
                                                    <th:block th:with="passwordCorrect=${isLogin or #strings.isEmpty(post.password) or (passCookie!=null and CookieUtils.checkPassCookie(passCookie, post, null))}">
                                                        <th:block th:if="${passwordCorrect}" th:text="${post.postTitle}"></th:block>
                                                        <th:block th:if="${!passwordCorrect}">
                                                            <span th:text="${'加密文章 ' + post.postId}"></span>
                                                            <span style="float: right">🔒</span>
                                                        </th:block>
                                                    </th:block>
                                                </a></td>
                                                </tr></tbody></table>
                                            </li>
                                    <th:block th:if="${i.last or postYear != posts[i.index + 1].createTime.year}" th:utext="'</ul>'"></th:block>
                                </th:block>
                        </div>
                </article>
            </main>
        </div>
        <footer th:replace="~{blog/sketch/footer::footer}"></footer>
    </div>
</body>
<script th:src="@{/blog/plugins/jquery/1.12.4/jquery-1.12.4.min.js}"></script>
</html>