#8 -- Fix data pagination on view.
This commit is contained in:
parent
33bf0bd8f3
commit
13abe00892
@ -61,7 +61,7 @@ public class GitFilteringController {
|
||||
Page<Commit> commitsPage = indexService.getCommits(repositoryUrl, branchName, new OffsetablePageRequest(currentPage, pageSize));
|
||||
int totalPages = commitsPage.getTotalPages();
|
||||
if (totalPages > 0) {
|
||||
List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages)
|
||||
List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages - 1)
|
||||
.boxed()
|
||||
.collect(Collectors.toList());
|
||||
model.addAttribute("pageNumbers", pageNumbers);
|
||||
|
@ -12,6 +12,24 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<style>
|
||||
.pagination {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.pagination a {
|
||||
color: black;
|
||||
float: left;
|
||||
padding: 5px 5px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.pagination a.active {
|
||||
background-color: gray;
|
||||
color: white;
|
||||
border-radius: 2px;
|
||||
}
|
||||
</style>
|
||||
<form action="#" th:action="${@route.FILTER_COMMITS}" th:object="${filterForm}" method="post">
|
||||
<p><b>Фильтровать данные:</b><Br></p>
|
||||
По автору
|
||||
@ -54,10 +72,12 @@
|
||||
<input type="submit" value="Отправить"/>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div th:if="${filterForm.commitPage.totalPages > 0}" class="pagination"
|
||||
Страницы:
|
||||
<div th:if="${filterForm.commitsPage.totalPages > 0}" class="pagination"
|
||||
th:each="pageNumber : ${pageNumbers}">
|
||||
<a th:href="@{/filtering.html(size=${commitPage.size}, page=${pageNumber})}"
|
||||
th:class="${pageNumber==commitPage.number + 1} ? active"></a>
|
||||
<a th:href="@{/filterCommits(size=${filterForm.commitsPage.size}, page=${pageNumber}, repositoryUrl=${filterForm.url}, branchName=${filterForm.branch})}"
|
||||
th:text=${pageNumber}
|
||||
th:class="${pageNumber == filterForm.commitsPage.number} ? active"></a>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user