summaryrefslogtreecommitdiffstats
path: root/routers/admin/users.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-11 20:42:26 -0400
committerUnknwon <u@gogs.io>2015-09-11 20:42:26 -0400
commitbe89802bd8131835ed894280e75bba9f769cf575 (patch)
treee61abeedbe2079ab00f399c3b9a5501bcebc656c /routers/admin/users.go
parent247017d9ff9b9947349555cdfd566cad061564ea (diff)
downloadgitea-be89802bd8131835ed894280e75bba9f769cf575.tar.gz
gitea-be89802bd8131835ed894280e75bba9f769cf575.zip
new admin user list UI
Diffstat (limited to 'routers/admin/users.go')
-rw-r--r--routers/admin/users.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/routers/admin/users.go b/routers/admin/users.go
index 2af3cdbc1f..bc2deac1a9 100644
--- a/routers/admin/users.go
+++ b/routers/admin/users.go
@@ -9,6 +9,7 @@ import (
"strings"
"github.com/Unknwon/com"
+ "github.com/Unknwon/paginater"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
@@ -46,15 +47,21 @@ func Users(ctx *middleware.Context) {
ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
- pageNum := 50
- p := pagination(ctx, models.CountUsers(), pageNum)
+ total := models.CountUsers()
+ page := ctx.QueryInt("page")
+ if page <= 1 {
+ page = 1
+ }
+ ctx.Data["Page"] = paginater.New(int(total), setting.AdminUserPagingNum, page, 5)
- users, err := models.GetUsers(pageNum, (p-1)*pageNum)
+ users, err := models.Users(page, setting.AdminUserPagingNum)
if err != nil {
- ctx.Handle(500, "GetUsers", err)
+ ctx.Handle(500, "Users", err)
return
}
ctx.Data["Users"] = users
+
+ ctx.Data["Total"] = total
ctx.HTML(200, USERS)
}