orgs.go 959 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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/db"
  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: db.UserTypeOrganization,
  21. Counter: db.Organizations.Count,
  22. Ranger: func(ctx gocontext.Context, page, pageSize int) ([]*db.User, error) {
  23. return db.Organizations.List(
  24. ctx,
  25. db.ListOrganizationsOptions{
  26. Page: page,
  27. PageSize: pageSize,
  28. },
  29. )
  30. },
  31. PageSize: conf.UI.Admin.OrgPagingNum,
  32. OrderBy: "id ASC",
  33. TplName: ORGS,
  34. })
  35. }