You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
780 B

  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. ORGS base.TplName = "admin/org/list"
  12. )
  13. func Organizations(ctx *middleware.Context) {
  14. ctx.Data["Title"] = ctx.Tr("admin.orgs")
  15. ctx.Data["PageIsAdmin"] = true
  16. ctx.Data["PageIsAdminOrganizations"] = true
  17. pageNum := 50
  18. p := pagination(ctx, models.CountOrganizations(), pageNum)
  19. var err error
  20. ctx.Data["Orgs"], err = models.GetOrganizations(pageNum, (p-1)*pageNum)
  21. if err != nil {
  22. ctx.Handle(500, "GetOrganizations", err)
  23. return
  24. }
  25. ctx.HTML(200, ORGS)
  26. }