diff options
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r-- | routers/repo/view.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go index 8c62b7e4a0..eeb5d5c05a 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -24,6 +24,7 @@ import ( const ( HOME base.TplName = "repo/home" WATCHERS base.TplName = "repo/watchers" + FORKS base.TplName = "repo/forks" ) func Home(ctx *middleware.Context) { @@ -278,3 +279,23 @@ func Stars(ctx *middleware.Context) { ctx.Data["PageIsStargazers"] = true renderItems(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers) } + +func Forks(ctx *middleware.Context) { + ctx.Data["Title"] = ctx.Tr("repos.forks") + + forks, err := ctx.Repo.Repository.GetForks() + if err != nil { + ctx.Handle(500, "GetForks", err) + return + } + + for _, fork := range forks { + if err = fork.GetOwner(); err != nil { + ctx.Handle(500, "GetOwner", err) + return + } + } + ctx.Data["Forks"] = forks + + ctx.HTML(200, FORKS) +} |