mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-08-31 14:56:06 +02:00
Fix admin user list pagination (#18957)
This commit is contained in:
parent
062fd4c217
commit
aee0fa68a7
2 changed files with 10 additions and 0 deletions
|
@ -55,3 +55,12 @@ func (p *Pagination) SetDefaultParams(ctx *Context) {
|
||||||
p.AddParam(ctx, "tab", "TabName")
|
p.AddParam(ctx, "tab", "TabName")
|
||||||
p.AddParam(ctx, "t", "queryType")
|
p.AddParam(ctx, "t", "queryType")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetUserFilterParams sets common pagination params for user filtering, e.g. the admin userlist
|
||||||
|
func (p *Pagination) SetUserFilterParams(ctx *Context) {
|
||||||
|
p.AddParamString("status_filter[is_active]", ctx.FormString("status_filter[is_active]"))
|
||||||
|
p.AddParamString("status_filter[is_admin]", ctx.FormString("status_filter[is_admin]"))
|
||||||
|
p.AddParamString("status_filter[is_restricted]", ctx.FormString("status_filter[is_restricted]"))
|
||||||
|
p.AddParamString("status_filter[is_2fa_enabled]", ctx.FormString("status_filter[is_2fa_enabled]"))
|
||||||
|
p.AddParamString("status_filter[is_prohibit_login]", ctx.FormString("status_filter[is_prohibit_login]"))
|
||||||
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions,
|
||||||
|
|
||||||
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
|
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
|
||||||
pager.SetDefaultParams(ctx)
|
pager.SetDefaultParams(ctx)
|
||||||
|
pager.SetUserFilterParams(ctx)
|
||||||
ctx.Data["Page"] = pager
|
ctx.Data["Page"] = pager
|
||||||
|
|
||||||
ctx.HTML(http.StatusOK, tplName)
|
ctx.HTML(http.StatusOK, tplName)
|
||||||
|
|
Loading…
Reference in a new issue