Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

org.go 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2021 The Gitea 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 explore
  5. import (
  6. "code.gitea.io/gitea/models"
  7. "code.gitea.io/gitea/modules/base"
  8. "code.gitea.io/gitea/modules/context"
  9. "code.gitea.io/gitea/modules/setting"
  10. "code.gitea.io/gitea/modules/structs"
  11. )
  12. const (
  13. // tplExploreOrganizations explore organizations page template
  14. tplExploreOrganizations base.TplName = "explore/organizations"
  15. )
  16. // Organizations render explore organizations page
  17. func Organizations(ctx *context.Context) {
  18. ctx.Data["UsersIsDisabled"] = setting.Service.Explore.DisableUsersPage
  19. ctx.Data["Title"] = ctx.Tr("explore")
  20. ctx.Data["PageIsExplore"] = true
  21. ctx.Data["PageIsExploreOrganizations"] = true
  22. ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
  23. visibleTypes := []structs.VisibleType{structs.VisibleTypePublic}
  24. if ctx.User != nil {
  25. visibleTypes = append(visibleTypes, structs.VisibleTypeLimited, structs.VisibleTypePrivate)
  26. }
  27. RenderUserSearch(ctx, &models.SearchUserOptions{
  28. Actor: ctx.User,
  29. Type: models.UserTypeOrganization,
  30. ListOptions: models.ListOptions{PageSize: setting.UI.ExplorePagingNum},
  31. Visible: visibleTypes,
  32. }, tplExploreOrganizations)
  33. }