orgs.go 779 B

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