forked from forgejo/forgejo
Finish new admin users pages
This commit is contained in:
parent
6558990e3a
commit
8829174574
25 changed files with 554 additions and 679 deletions
|
@ -23,7 +23,6 @@ import (
|
|||
|
||||
const (
|
||||
DASHBOARD base.TplName = "admin/dashboard"
|
||||
USERS base.TplName = "admin/users"
|
||||
REPOS base.TplName = "admin/repos"
|
||||
AUTHS base.TplName = "admin/auths"
|
||||
CONFIG base.TplName = "admin/config"
|
||||
|
@ -157,35 +156,6 @@ func Dashboard(ctx *middleware.Context) {
|
|||
ctx.HTML(200, DASHBOARD)
|
||||
}
|
||||
|
||||
func Users(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "User Management"
|
||||
ctx.Data["PageIsUsers"] = true
|
||||
|
||||
p := com.StrTo(ctx.Query("p")).MustInt()
|
||||
if p < 1 {
|
||||
p = 1
|
||||
}
|
||||
pageNum := 50
|
||||
count := models.CountUsers()
|
||||
curCount := int64((p-1)*pageNum + pageNum)
|
||||
if curCount > count {
|
||||
p = int(count) / pageNum
|
||||
} else if count > curCount {
|
||||
ctx.Data["NextPageNum"] = p + 1
|
||||
}
|
||||
if p > 1 {
|
||||
ctx.Data["LastPageNum"] = p - 1
|
||||
}
|
||||
|
||||
var err error
|
||||
ctx.Data["Users"], err = models.GetUsers(pageNum, (p-1)*pageNum)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "admin.Users(GetUsers)", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(200, USERS)
|
||||
}
|
||||
|
||||
func Repositories(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "Repository Management"
|
||||
ctx.Data["PageIsRepos"] = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue