refactor: replace inline banner with dynamic component grid and update CSS layouts

This commit is contained in:
2026-07-17 15:30:44 +07:00
parent fd4ad87a32
commit 49b8d2b2ea
9 changed files with 668 additions and 185 deletions
@@ -304,7 +304,7 @@
height: 100%;
display: flex;
}
.featured-grid__item .news-card--featured {
/* .featured-grid__item .news-card--featured {
display: flex;
flex-direction: column;
align-items: flex-start;
@@ -317,7 +317,7 @@
gap: 16px;
background: #fff;
margin-bottom: 0 !important;
}
} */
.featured-grid__item .news-card__image {
flex: none;
width: 100%;
@@ -398,7 +398,7 @@
height: 100%;
display: flex;
}
.featured-grid__item .news-card--featured {
/* .featured-grid__item .news-card--featured {
display: flex;
flex-direction: row;
align-items: flex-start;
@@ -411,11 +411,11 @@
gap: 16px;
background: #fff;
margin-bottom: 0 !important;
}
} */
.featured-grid__item .news-card__image {
flex: 0 0 170px;
width: 100%;
height: 170px;
height: auto;
margin-bottom: 0 !important;
}
.featured-grid__item .news-card__image > div {
@@ -41,12 +41,16 @@
</div>
<div class="card-body">
<form th:action="@{/manage/posts}" method="get" class="form-inline">
<div class="form-group mr-3 mb-2">
<label for="filterSearch" class="mr-2 font-weight-bold">Search:</label>
<input type="text" class="form-control form-control-sm" id="filterSearch" name="search" th:value="${selectedSearch}" placeholder="Title or content...">
</div>
<div class="form-group mr-3 mb-2">
<label for="filterCategory" class="mr-2 font-weight-bold">Category:</label>
<select class="form-control form-control-sm" id="filterCategory" name="categoryId">
<option value="">All Categories</option>
<option th:each="cat : ${categories}" th:value="${cat.id}" th:text="${cat.name}"
th:selected="${selectedCategoryId != null && selectedCategoryId == cat.id}"></option>
th:selected="${selectedCategoryId != null and selectedCategoryId == cat.id}"></option>
</select>
</div>
<div class="form-group mr-3 mb-2">
@@ -54,7 +58,16 @@
<select class="form-control form-control-sm" id="filterStatus" name="status">
<option value="">All Statuses</option>
<option th:each="s : ${statuses}" th:value="${s}" th:text="${s}"
th:selected="${selectedStatus != null && selectedStatus == s.name()}"></option>
th:selected="${selectedStatus != null and selectedStatus == s.name()}"></option>
</select>
</div>
<div class="form-group mr-3 mb-2">
<label for="filterSize" class="mr-2 font-weight-bold">Show:</label>
<select class="form-control form-control-sm" id="filterSize" name="size">
<option value="10" th:selected="${pageSize == 10}">10</option>
<option value="20" th:selected="${pageSize == 20}">20</option>
<option value="50" th:selected="${pageSize == 50}">50</option>
<option value="100" th:selected="${pageSize == 100}">100</option>
</select>
</div>
<button type="submit" class="btn btn-sm btn-primary mb-2 mr-2">
@@ -89,7 +102,7 @@
</thead>
<tbody>
<tr th:each="post, iterStat : ${posts}">
<td th:text="${iterStat.count}"></td>
<td th:text="${(postPage.number * postPage.size) + iterStat.count}"></td>
<td>
<a th:href="@{/manage/posts/{id}/edit(id=${post.id})}" class="font-weight-bold text-primary"
th:text="${post.title}"></a>
@@ -146,12 +159,38 @@
<tr th:if="${#lists.isEmpty(posts)}">
<td colspan="8" class="text-center text-muted py-4">
<i class="fas fa-newspaper fa-2x mb-2 d-block"></i>
No posts found. Click "Add New Post" to create one.
No posts found.
</td>
</tr>
</tbody>
</table>
</div>
<!-- Pagination -->
<div th:if="${postPage.totalPages gt 1}" class="d-flex justify-content-between align-items-center mt-3">
<div>
Showing <span th:text="${(postPage.number * postPage.size) + 1}"></span> to
<span th:text="${(postPage.number * postPage.size) + postPage.numberOfElements}"></span> of
<span th:text="${postPage.totalElements}"></span> entries
</div>
<nav>
<ul class="pagination mb-0">
<li class="page-item" th:classappend="${postPage.first ? 'disabled' : ''}">
<a class="page-link" th:href="@{/manage/posts(page=${postPage.number - 1}, size=${pageSize}, categoryId=${selectedCategoryId}, status=${selectedStatus}, search=${selectedSearch})}">Previous</a>
</li>
<li class="page-item" th:each="i : ${#numbers.sequence(0, postPage.totalPages - 1)}"
th:classappend="${postPage.number == i ? 'active' : ''}">
<a class="page-link" th:href="@{/manage/posts(page=${i}, size=${pageSize}, categoryId=${selectedCategoryId}, status=${selectedStatus}, search=${selectedSearch})}" th:text="${i + 1}"></a>
</li>
<li class="page-item" th:classappend="${postPage.last ? 'disabled' : ''}">
<a class="page-link" th:href="@{/manage/posts(page=${postPage.number + 1}, size=${pageSize}, categoryId=${selectedCategoryId}, status=${selectedStatus}, search=${selectedSearch})}">Next</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>