aboutsummaryrefslogtreecommitdiffstats
path: root/modules/context/pagination.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-03-14 13:11:38 +0800
committerGitHub <noreply@github.com>2023-03-14 13:11:38 +0800
commit6ff5400af91aefb02cbc7dd59f6be23cc2bf7865 (patch)
treef16e7e5223ac37bc795a96679309eecc8ce67a12 /modules/context/pagination.go
parent0efa9d564941e6539df98ed4ddd906a05c1fa7e7 (diff)
downloadgitea-6ff5400af91aefb02cbc7dd59f6be23cc2bf7865.tar.gz
gitea-6ff5400af91aefb02cbc7dd59f6be23cc2bf7865.zip
Make branches list page operations remember current page (#23420)
Close #23411 Always pass "page" query parameter to backend, and make backend respect it. The `ctx.FormInt("limit")` is never used, so removed. --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/context/pagination.go')
-rw-r--r--modules/context/pagination.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/context/pagination.go b/modules/context/pagination.go
index 3effd88f10..5a88c92053 100644
--- a/modules/context/pagination.go
+++ b/modules/context/pagination.go
@@ -18,10 +18,11 @@ type Pagination struct {
urlParams []string
}
-// NewPagination creates a new instance of the Pagination struct
-func NewPagination(total, page, issueNum, numPages int) *Pagination {
+// NewPagination creates a new instance of the Pagination struct.
+// "pagingNum" is "page size" or "limit", "current" is "page"
+func NewPagination(total, pagingNum, current, numPages int) *Pagination {
p := &Pagination{}
- p.Paginater = paginator.New(total, page, issueNum, numPages)
+ p.Paginater = paginator.New(total, pagingNum, current, numPages)
return p
}