orgs.go 941 B

12345678910111213141516171819202122232425262728293031323334353637
  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. gocontext "context"
  7. "gogs.io/gogs/internal/conf"
  8. "gogs.io/gogs/internal/context"
  9. "gogs.io/gogs/internal/database"
  10. "gogs.io/gogs/internal/route"
  11. )
  12. const (
  13. ORGS = "admin/org/list"
  14. )
  15. func Organizations(c *context.Context) {
  16. c.Data["Title"] = c.Tr("admin.organizations")
  17. c.Data["PageIsAdmin"] = true
  18. c.Data["PageIsAdminOrganizations"] = true
  19. route.RenderUserSearch(c, &route.UserSearchOptions{
  20. Type: database.UserTypeOrganization,
  21. Counter: func(gocontext.Context) int64 {
  22. return database.CountOrganizations()
  23. },
  24. Ranger: func(_ gocontext.Context, page, pageSize int) ([]*database.User, error) {
  25. return database.Organizations(page, pageSize)
  26. },
  27. PageSize: conf.UI.Admin.OrgPagingNum,
  28. OrderBy: "id ASC",
  29. TplName: ORGS,
  30. })
  31. }