mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-30 17:57:10 +00:00
refactor: pagination/pager (#39162)
This commit is contained in:
@@ -161,8 +161,7 @@ func home(ctx *context.Context, viewRepositories bool) {
|
||||
ctx.Data["Repos"] = repos
|
||||
ctx.Data["Total"] = count
|
||||
|
||||
pager := context.NewPagination(count, setting.UI.User.RepoPagingNum, page, 5)
|
||||
pager.AddParamFromRequest(ctx.Req)
|
||||
pager := context.NewPagerBuilder(ctx).TotalCount(count).PerPageLimit(setting.UI.User.RepoPagingNum).CurPage(page).Build()
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplOrgHome)
|
||||
|
||||
@@ -62,9 +62,8 @@ func Members(ctx *context.Context) {
|
||||
}
|
||||
|
||||
pageSize := setting.UI.MembersPagingNum
|
||||
pager := context.NewPagination(total, pageSize, page, 5)
|
||||
pager.AddParamFromRequest(ctx.Req)
|
||||
opts.ListOptions.Page = pager.Paginater.Current()
|
||||
pager := context.NewPagerBuilder(ctx).TotalCount(total).PerPageLimit(pageSize).CurPage(page).Build()
|
||||
opts.ListOptions.Page = pager.Paginator.Current()
|
||||
opts.ListOptions.PageSize = pageSize
|
||||
members, membersIsPublic, err := organization.FindOrgMembers(ctx, opts)
|
||||
if err != nil {
|
||||
|
||||
@@ -103,8 +103,7 @@ func Projects(ctx *context.Context) {
|
||||
project.RenderedContent = renderUtils.MarkdownToHtml(project.Description)
|
||||
}
|
||||
|
||||
pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, 5)
|
||||
pager.AddParamFromRequest(ctx.Req)
|
||||
pager := context.NewPagerBuilder(ctx).TotalCount(total).PerPageLimit(setting.UI.IssuePagingNum).CurPage(page).Build()
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
|
||||
|
||||
@@ -103,8 +103,7 @@ func Teams(ctx *context.Context) {
|
||||
|
||||
ctx.Data["OrgListTeams"] = teams
|
||||
ctx.Data["Keyword"] = keyword
|
||||
pager := context.NewPagination(count, setting.UI.MembersPagingNum, page, 5)
|
||||
pager.AddParamFromRequest(ctx.Req)
|
||||
pager := context.NewPagerBuilder(ctx).TotalCount(count).PerPageLimit(setting.UI.MembersPagingNum).CurPage(page).Build()
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, tplTeams)
|
||||
|
||||
Reference in New Issue
Block a user