fix has param logic

fix paginator for search user by group
This commit is contained in:
Azareal 2021-01-20 18:10:50 +10:00
parent f69e077347
commit 70d66e7dd8
1 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,7 @@ func Users(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError {
/*if group == "" { /*if group == "" {
gid = -1 gid = -1
}*/ }*/
hasParam = hasParam && gid > 0 hasParam = hasParam || gid > 0
page, _ := strconv.Atoi(r.FormValue("page")) page, _ := strconv.Atoi(r.FormValue("page"))
perPage := 15 perPage := 15
@ -72,6 +72,9 @@ func Users(w http.ResponseWriter, r *http.Request, u *c.User) c.RouteError {
if email != "" { if email != "" {
params += "s-email=" + email + "&" params += "s-email=" + email + "&"
} }
if gid > 0 {
params += "s-group=" + strconv.Itoa(gid) + "&"
}
} }
pageList := c.Paginate(page, lastPage, 5) pageList := c.Paginate(page, lastPage, 5)
pi := c.PanelUserPage{basePage, users, allGroups, search, c.PaginatorMod{template.URL(params), pageList, page, lastPage}} pi := c.PanelUserPage{basePage, users, allGroups, search, c.PaginatorMod{template.URL(params), pageList, page, lastPage}}