|
28 | 28 | <attr sel=".comment-textbox" th:name="content" />
|
29 | 29 | </attr>
|
30 | 30 |
|
31 |
| - <attr sel="#article-comments" th:remove="all-but-first"> |
32 |
| - <attr sel=".parent-comment[0]" th:each="articleComment : ${articleComments}"> |
| 31 | + <attr sel=".article-comments" |
| 32 | + th:remove="all-but-first" |
| 33 | + th:fragment="articleComments(childComments)" |
| 34 | + th:classappend="${childComments} != null ? 'row me-0' : 'row col-md-10 col-lg-8 pt-3'" |
| 35 | + > |
| 36 | + <attr sel=".article-comment[0]" th:each="articleComment : ${childComments} ?: ${articleComments}"> |
33 | 37 | <attr sel=".comment-delete-form" th:action="'/comments/' + ${articleComment.id} + '/delete'" th:method="post">
|
34 | 38 | <attr sel="div/strong" th:text="${articleComment.nickname}" />
|
35 | 39 | <attr sel="div/small/time" th:datetime="${articleComment.createdAt}" th:text="${#temporals.format(articleComment.createdAt, 'yyyy-MM-dd HH:mm:ss')}" />
|
36 | 40 | <attr sel="div/p" th:text="${articleComment.content}" />
|
37 | 41 | <attr sel="button" th:if="${#authorization.expression('isAuthenticated()')} and ${articleComment.userId} == ${#authentication.name}" />
|
38 | 42 | </attr>
|
39 |
| - <attr sel="ul" th:if="${articleComment.childComments != null and !articleComment.childComments.isEmpty()}" |
40 |
| - th:remove="all-but-first"> |
41 |
| - <attr sel=".child-comment[0]" th:each="childComment : ${articleComment.childComments}"> |
42 |
| - <attr sel=".comment-delete-form" th:action="'/comments/' + ${childComment.id} + '/delete'" th:method="post"> |
43 |
| - <attr sel="div/strong" th:text="${childComment.nickname}" /> |
44 |
| - <attr sel="div/small/time" th:datetime="${childComment.createdAt}" th:text="${#temporals.format(childComment.createdAt, 'yyyy-MM-dd HH:mm:ss')}" /> |
45 |
| - <attr sel="div/p" th:text="${childComment.content}" /> |
46 |
| - <attr sel="button" th:if="${#authorization.expression('isAuthenticated()')} and ${childComment.userId} == ${#authentication.name}" /> |
47 |
| - </attr> |
48 |
| - </attr> |
49 |
| - </attr> |
| 43 | + |
| 44 | + <attr sel=".child-comments" th:unless="${articleComment.childComments.isEmpty}" th:replace=":: articleComments(${articleComment.childComments})" /> |
50 | 45 | </attr>
|
51 | 46 | <attr sel=".parent-comment-id" th:name="parentCommentId" th:value="${articleComment.id}" />
|
52 | 47 | </attr>
|
|
0 commit comments