#16 board : index, detail view

This commit is contained in:
haerong22
2022-08-19 02:48:42 +09:00
parent ef53f97d60
commit 1cb4dcf69e
6 changed files with 78 additions and 45 deletions

View File

@@ -16,6 +16,10 @@ public record UserAccountDto(
LocalDateTime modifiedAt,
String modifiedBy
) {
public static UserAccountDto of(Long id, String userId, String userPassword, String email, String nickname, String memo) {
return new UserAccountDto(id, userId, userPassword, email, nickname, memo, null, null, null, null);
}
public static UserAccountDto of(Long id, String userId, String userPassword, String email, String nickname, String memo, LocalDateTime createdAt, String createdBy, LocalDateTime modifiedAt, String modifiedBy) {
return new UserAccountDto(id, userId, userPassword, email, nickname, memo, createdAt, createdBy, modifiedAt, modifiedBy);
}

View File

@@ -23,7 +23,7 @@
</header>
<div class="row g-5">
<section class="col-md-5 col-lg-4 order-md-last">
<section class="col-md-3 col-lg-4 order-md-last">
<aside>
<p><span id="nickname" class="nick-name">Bobby</span></p>
<p><a id="email" class="u-url" rel="me" href="mailto:haerong22@gmail.com">bobby@mail.com</a></p>
@@ -32,27 +32,36 @@
</aside>
</section>
<article id="article-content" class="col-md-7 col-lg-8">
<article id="article-content" class="col-md-9 col-lg-8">
<pre>본문<br><br></pre>
</article>
</div>
<div class="row g-5" id="article-buttons">
<form id="delete-article-form">
<div class="pb-5 d-grid gap-2 d-md-block">
<a class="btn btn-success me-md-2" role="button" id="update-article">수정</a>
<button class="btn btn-danger me-md-2" type="submit">삭제</button>
</div>
</form>
</div>
<div class="row g-5">
<section>
<form class="row g-3">
<div class="col-8">
<div class="col-md-9 col-lg-8">
<label for="comment-textbox" hidden>댓글</label>
<textarea class="form-control" id="comment-textbox" placeholder="댓글 쓰기.." rows="3"></textarea>
</div>
<div class="col-auto">
<div class="col-md-3 col-lg-4">
<label for="comment-submit" hidden>댓글 쓰기</label>
<button class="btn btn-primary" id="comment-submit" type="submit">쓰기</button>
</div>
</form>
<ul id="article-comments" class="row col-7">
<ul id="article-comments" class="row col-md-10 col-lg-8 pt-3">
<li>
<div>
<div class="row">
<strong>Bobby</strong>
<small><time>2022-08-12</time></small>
<p>
@@ -62,7 +71,7 @@
</div>
</li>
<li>
<div>
<div class="row">
<time><small>2022-08-12</small></time>
<strong>Bobby</strong>
<p>

View File

@@ -12,6 +12,12 @@
<attr sel="#article-content/pre" th:text="*{content}" />
</attr>
<attr sel="#article-buttons">
<attr sel="#delete-article-form" th:action="'/articles/' + *{id} + '/delete'" th:method="post">
<attr sel="#update-article" th:href="'/articles/' + *{id} + '/form'" />
</attr>
</attr>
<attr sel="#article-comments" th:remove="all-but-first">
<attr sel="li[0]" th:each="articleComment : ${articleComments}">
<attr sel="div/strong" th:text="${articleComment.nickname}" />

View File

@@ -23,7 +23,7 @@
<div class="row">
<div class="card card-margin search-form">
<div class="card-body p-0">
<form action="/articles" method="get">
<form id="search-form">
<div class="row">
<div class="col-12">
<div class="row no-gutters">
@@ -57,45 +57,55 @@
</div>
</div>
<table class="table" id="article-table">
<thead>
<tr>
<th class="title col-6"><a>제목</a></th>
<th class="hashtag col-2"><a>해시태그</a></th>
<th class="user-id col"><a>작성자</a></th>
<th class="created-at col"><a>작성</a></th>
</tr>
</thead>
<div class="row">
<table class="table" id="article-table">
<thead>
<tr>
<th class="title col-6"><a>제목</a></th>
<th class="hashtag col-2"><a>해시태그</a></th>
<th class="user-id col"><a>작성</a></th>
<th class="created-at col"><a>작성일</a></th>
</tr>
</thead>
<tbody>
<tr>
<td class="title"><a>첫 글</a></td>
<td class="hashtag">#Java</td>
<td class="user-id">kim</td>
<td class="created-at"><time>2022-08-09</time></td>
</tr>
<tr>
<td>두번째 글</td>
<td>#Spring</td>
<td>kim</td>
<td>2022-08-09</td>
</tr>
<tr>
<td>세번째 글</td>
<td>#Mysql</td>
<td>kim</td>
<td>2022-08-09</td>
</tr>
</tbody>
</table>
<tbody>
<tr>
<td class="title col-6"><a>첫 글</a></td>
<td class="hashtag col-2">#Java</td>
<td class="user-id">kim</td>
<td class="created-at"><time>2022-08-09</time></td>
</tr>
<tr>
<td>두번째 글</td>
<td>#Spring</td>
<td>kim</td>
<td>2022-08-09</td>
</tr>
<tr>
<td>세번째 글</td>
<td>#Mysql</td>
<td>kim</td>
<td>2022-08-09</td>
</tr>
</tbody>
</table>
</div>
<nav id="pagination" aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item"><a class="page-link" href="#">Previous</a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">Next</a></li>
</ul>
</nav>
<div class="row">
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
<a class="btn btn-primary me-md-2" role="button" id="write-article">글쓰기</a>
</div>
</div>
<div class="row">
<nav id="pagination" aria-label="Page navigation">
<ul class="pagination justify-content-center">
<li class="page-item"><a class="page-link" href="#">Previous</a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">Next</a></li>
</ul>
</nav>
</div>
</main>
<footer id="footer">

View File

@@ -4,6 +4,7 @@
<attr sel="#footer" th:replace="footer :: footer" />
<attr sel="main" th:object="${articles}">
<attr sel="#search-form" th:action="@{/articles}" th:method="get" />
<attr sel="#search-type" th:remove="all-but-first">
<attr sel="option[0]"
@@ -53,6 +54,8 @@
</attr>
</attr>
<attr sel="#write-article" th:href="@{/articles/form}" />
<attr sel="#pagination">
<attr sel="li[0]/a"
th:text="'previous'"