summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-16 23:33:40 -0500
committerUnknwon <u@gogs.io>2015-11-16 23:33:40 -0500
commitab9411be2ae01970f4c2c092683bd9d9b71c994b (patch)
tree22d93d50518c81893429e88e6eccf64b0e1ead55 /routers
parent114e6790f8013474943718b478c27ea96cb22e18 (diff)
downloadgitea-ab9411be2ae01970f4c2c092683bd9d9b71c994b.tar.gz
gitea-ab9411be2ae01970f4c2c092683bd9d9b71c994b.zip
clean up code
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/forks.go37
-rw-r--r--routers/repo/view.go21
2 files changed, 21 insertions, 37 deletions
diff --git a/routers/repo/forks.go b/routers/repo/forks.go
deleted file mode 100644
index 099f0cc4f6..0000000000
--- a/routers/repo/forks.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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)
-}
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)
+}