summaryrefslogtreecommitdiffstats
path: root/routers/admin/repos.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-13 09:51:51 -0400
committerUnknwon <u@gogs.io>2015-09-13 09:51:51 -0400
commit8e0a69f86a9e103d1d82d3c5000e01b4e2570a51 (patch)
tree6c0802f63be1ff7867b80375b406dd8b520f6b1e /routers/admin/repos.go
parente2d6b0116e44ca0fa2c577f40adde4ebfa612ae0 (diff)
downloadgitea-8e0a69f86a9e103d1d82d3c5000e01b4e2570a51.tar.gz
gitea-8e0a69f86a9e103d1d82d3c5000e01b4e2570a51.zip
#697 disable captcha and new admin create user UI
Diffstat (limited to 'routers/admin/repos.go')
-rw-r--r--routers/admin/repos.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/routers/admin/repos.go b/routers/admin/repos.go
index 6d9169f94d..3f63887139 100644
--- a/routers/admin/repos.go
+++ b/routers/admin/repos.go
@@ -5,6 +5,8 @@
package admin
import (
+ "math"
+
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/middleware"
@@ -14,6 +16,23 @@ const (
REPOS base.TplName = "admin/repo/list"
)
+func pagination(ctx *middleware.Context, count int64, pageNum int) int {
+ p := ctx.QueryInt("p")
+ if p < 1 {
+ p = 1
+ }
+ curCount := int64((p-1)*pageNum + pageNum)
+ if curCount >= count {
+ p = int(math.Ceil(float64(count) / float64(pageNum)))
+ } else {
+ ctx.Data["NextPageNum"] = p + 1
+ }
+ if p > 1 {
+ ctx.Data["LastPageNum"] = p - 1
+ }
+ return p
+}
+
func Repositories(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("admin.repositories")
ctx.Data["PageIsAdmin"] = true