summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-03-14 08:51:14 -0400
committerGitHub <noreply@github.com>2023-03-14 20:51:14 +0800
commit8536dc4b73a22be203659c0b64bba7537efa63d7 (patch)
tree774c2321bc54a2e9d593ab66a7a10cb9f1f375e1 /modules
parent0a0f46f2990ada3abf4661f89ffe4ed539690e29 (diff)
downloadgitea-8536dc4b73a22be203659c0b64bba7537efa63d7.tar.gz
gitea-8536dc4b73a22be203659c0b64bba7537efa63d7.zip
Make branches list page operations remember current page (#23420) (#23460)
Backport #23420 by @wxiaoguang 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: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules')
-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
}