#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));
|
Page<Commit> commitsPage = indexService.getCommits(repositoryUrl, branchName, new OffsetablePageRequest(currentPage, pageSize));
|
||||||
int totalPages = commitsPage.getTotalPages();
|
int totalPages = commitsPage.getTotalPages();
|
||||||
if (totalPages > 0) {
|
if (totalPages > 0) {
|
||||||
List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages)
|
List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages - 1)
|
||||||
.boxed()
|
.boxed()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
model.addAttribute("pageNumbers", pageNumbers);
|
model.addAttribute("pageNumbers", pageNumbers);
|
||||||
|
@ -12,6 +12,24 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||||
</head>
|
</head>
|
||||||
<div class="container" layout:fragment="content">
|
<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">
|
<form action="#" th:action="${@route.FILTER_COMMITS}" th:object="${filterForm}" method="post">
|
||||||
<p><b>Фильтровать данные:</b><Br></p>
|
<p><b>Фильтровать данные:</b><Br></p>
|
||||||
По автору
|
По автору
|
||||||
@ -54,10 +72,12 @@
|
|||||||
<input type="submit" value="Отправить"/>
|
<input type="submit" value="Отправить"/>
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
Страницы:
|
||||||
<div th:if="${filterForm.commitPage.totalPages > 0}" class="pagination"
|
<div th:if="${filterForm.commitsPage.totalPages > 0}" class="pagination"
|
||||||
th:each="pageNumber : ${pageNumbers}">
|
th:each="pageNumber : ${pageNumbers}">
|
||||||
<a th:href="@{/filtering.html(size=${commitPage.size}, page=${pageNumber})}"
|
<a th:href="@{/filterCommits(size=${filterForm.commitsPage.size}, page=${pageNumber}, repositoryUrl=${filterForm.url}, branchName=${filterForm.branch})}"
|
||||||
th:class="${pageNumber==commitPage.number + 1} ? active"></a>
|
th:text=${pageNumber}
|
||||||
|
th:class="${pageNumber == filterForm.commitsPage.number} ? active"></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user