mirror of https://github.com/gogits/gogs.git
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.
38 lines
727 B
38 lines
727 B
9 years ago
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
|
package repo
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/gogits/gogs/modules/base"
|
||
|
"github.com/gogits/gogs/modules/middleware"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
FORKS base.TplName = "repo/forks"
|
||
|
)
|
||
|
|
||
|
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", fmt.Errorf("%d: %v", fork.ID, err))
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ctx.Data["Forks"] = forks
|
||
|
|
||
|
ctx.HTML(200, FORKS)
|
||
|
}
|