repos.go 805 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package admin
  5. import (
  6. "github.com/gogits/gogs/models"
  7. "github.com/gogits/gogs/modules/base"
  8. "github.com/gogits/gogs/modules/middleware"
  9. )
  10. const (
  11. REPOS base.TplName = "admin/repo/list"
  12. )
  13. func Repositories(ctx *middleware.Context) {
  14. ctx.Data["Title"] = ctx.Tr("admin.repositories")
  15. ctx.Data["PageIsAdmin"] = true
  16. ctx.Data["PageIsAdminRepositories"] = true
  17. pageNum := 50
  18. p := pagination(ctx, models.CountRepositories(), pageNum)
  19. var err error
  20. ctx.Data["Repos"], err = models.GetRepositoriesWithUsers(pageNum, (p-1)*pageNum)
  21. if err != nil {
  22. ctx.Handle(500, "GetRepositoriesWithUsers", err)
  23. return
  24. }
  25. ctx.HTML(200, REPOS)
  26. }