Skip to content

Commit

Permalink
Merge pull request #171 from nhnacademy-be4-My-Books/feature/category
Browse files Browse the repository at this point in the history
refactor: 카테고리 관리 페이지 container 추가
  • Loading branch information
damho-lee authored Mar 27, 2024
2 parents f4389ac + 8d87ea2 commit e202740
Showing 1 changed file with 45 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,57 @@
layout:decorate="~{common/layout/admin-layout}">

<div layout:fragment="content">

<script>
let url = "/admin/category"
let currentPage = [[${categories.number}]]
let totalPages = [[${categories.totalPages}]]
</script>
<h1>카테고리 페이지</h1>
<div>
<div>
<a th:href="@{/admin/category/register}" class="btn btn-primary" role="button">카테고리 추가하기</a>
</div>
<div class="container">
<h1>카테고리 페이지</h1>
<div>
<table class="table">
<thead>
<tr>
<th scope="col">부모 카테고리 이름</th>
<th scope="col">카테고리 이름</th>
<th scope="col">수정하기</th>
<th scope="col">삭제하기</th>
</tr>
</thead>
<tbody>
<tr th:each="category : ${categories.content}">
<th th:if="${category.parentCategoryName == null}"></th>
<th th:unless="${category.parentCategoryName == null}"
th:text="${category.parentCategoryName}"></th>
<th th:text="${category.name}"></th>
<th>
<form action="/admin/category/update" method="get">
<input hidden="hidden" name="id" th:value="${category.id}">
<button class="btn btn-primary" type="submit" th:text="수정하기"></button>
</form>
</th>
<th>
<form th:action="@{/admin/category/delete/{id}(id=${category.id})}" th:method="post">
<button class="btn btn-secondary" type="submit" th:text="삭제하기"></button>
</form>
</th>
</tr>
</tbody>
</table>
</div>
<div class="mt-3" th:block th:if="${categories.totalPages > 1}">
<div class="pagination">
<div class="page-item">
<a class="page-link" id="prevLink" th:text="'<'" th:href="@{#}"></a>
</div>
<div class="pagination" id="pageNumContainer"></div>
<div class="page-item">
<a class="page-link" id="nextLink" th:text="'>'" th:href="@{#}"></a>
<div>
<a th:href="@{/admin/category/register}" class="btn btn-primary" role="button">카테고리 추가하기</a>
</div>
<div>
<table class="table">
<thead>
<tr>
<th scope="col">부모 카테고리 이름</th>
<th scope="col">카테고리 이름</th>
<th scope="col">수정하기</th>
<th scope="col">삭제하기</th>
</tr>
</thead>
<tbody>
<tr th:each="category : ${categories.content}">
<th th:if="${category.parentCategoryName == null}"></th>
<th th:unless="${category.parentCategoryName == null}"
th:text="${category.parentCategoryName}"></th>
<th th:text="${category.name}"></th>
<th>
<form action="/admin/category/update" method="get">
<input hidden="hidden" name="id" th:value="${category.id}">
<button class="btn btn-primary" type="submit" th:text="수정하기"></button>
</form>
</th>
<th>
<form th:action="@{/admin/category/delete/{id}(id=${category.id})}" th:method="post">
<button class="btn btn-secondary" type="submit" th:text="삭제하기"></button>
</form>
</th>
</tr>
</tbody>
</table>
</div>
<div class="mt-3" th:block th:if="${categories.totalPages > 1}">
<div class="pagination">
<div class="page-item">
<a class="page-link" id="prevLink" th:text="'<'" th:href="@{#}"></a>
</div>
<div class="pagination" id="pageNumContainer"></div>
<div class="page-item">
<a class="page-link" id="nextLink" th:text="'>'" th:href="@{#}"></a>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit e202740

Please sign in to comment.