summaryrefslogtreecommitdiffstats
path: root/routers/admin
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-09-25 19:03:53 -0400
committer无闻 <u@gogs.io>2015-09-25 19:03:53 -0400
commitee1256cf74f7f42f19fa22f77100aed78ad94987 (patch)
tree0c5bc5b1ed8215b169a9a66d7bf1457827721374 /routers/admin
parent0d5e57e4aeaaafcb9ddcaac095a4f187d2eaabb4 (diff)
parenta8fd615adc73bc5d37c753f14ec9738d1590e363 (diff)
downloadgitea-ee1256cf74f7f42f19fa22f77100aed78ad94987.tar.gz
gitea-ee1256cf74f7f42f19fa22f77100aed78ad94987.zip
Merge pull request #1691 from sapk/fix-admin-organization-new-ui
Fix admin organization new ui
Diffstat (limited to 'routers/admin')
-rw-r--r--routers/admin/orgs.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/routers/admin/orgs.go b/routers/admin/orgs.go
index 54d7af5cb3..ae68b872d0 100644
--- a/routers/admin/orgs.go
+++ b/routers/admin/orgs.go
@@ -5,9 +5,12 @@
package admin
import (
+ "github.com/Unknwon/paginater"
+
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/middleware"
+ "github.com/gogits/gogs/modules/setting"
)
const (
@@ -15,18 +18,26 @@ const (
)
func Organizations(ctx *middleware.Context) {
- ctx.Data["Title"] = ctx.Tr("admin.orgs")
+ ctx.Data["Title"] = ctx.Tr("admin.organizations")
ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminOrganizations"] = true
- pageNum := 50
- p := pagination(ctx, models.CountOrganizations(), pageNum)
-
- var err error
- ctx.Data["Orgs"], err = models.GetOrganizations(pageNum, (p-1)*pageNum)
+ total := models.CountOrganizations()
+ page := ctx.QueryInt("page")
+ if page <= 1 {
+ page = 1
+ }
+ ctx.Data["Page"] = paginater.New(int(total), setting.AdminOrgPagingNum, page, 5)
+
+ orgs, err := models.Organizations(page, setting.AdminOrgPagingNum)
+
if err != nil {
- ctx.Handle(500, "GetOrganizations", err)
+ ctx.Handle(500, "Organizations", err)
return
}
+
+ ctx.Data["Orgs"] = orgs
+ ctx.Data["Total"] = total
+
ctx.HTML(200, ORGS)
}