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.

37 lines
727 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 repo
  5. import (
  6. "fmt"
  7. "github.com/gogits/gogs/modules/base"
  8. "github.com/gogits/gogs/modules/middleware"
  9. )
  10. const (
  11. FORKS base.TplName = "repo/forks"
  12. )
  13. func Forks(ctx *middleware.Context) {
  14. ctx.Data["Title"] = ctx.Tr("repos.forks")
  15. forks, err := ctx.Repo.Repository.GetForks()
  16. if err != nil {
  17. ctx.Handle(500, "GetForks", err)
  18. return
  19. }
  20. for _, fork := range forks {
  21. if err = fork.GetOwner(); err != nil {
  22. ctx.Handle(500, "GetOwner", fmt.Errorf("%d: %v", fork.ID, err))
  23. return
  24. }
  25. }
  26. ctx.Data["Forks"] = forks
  27. ctx.HTML(200, FORKS)
  28. }