From fecafdca2ac5884a4dbcef2b937dfc3d2bf27ef2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 13 Mar 2014 12:45:41 +0800 Subject: [PATCH] merge --- routers/repo/repo.go | 16 ---------------- routers/repo/single.go | 14 ++++++++++++-- templates/repo/repo.tmpl | 10 ---------- templates/repo/single.tmpl | 6 +++++- web.go | 2 -- 5 files changed, 17 insertions(+), 31 deletions(-) delete mode 100644 templates/repo/repo.tmpl diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 6444034525..5769aff7c3 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -6,8 +6,6 @@ package repo import ( "net/http" - - "github.com/codegangsta/martini" "github.com/martini-contrib/render" "github.com/martini-contrib/sessions" @@ -87,20 +85,6 @@ func Delete(req *http.Request, r render.Render, data base.TmplData, session sess } } -func Repo(params martini.Params, req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { - data["Title"] = "Repository" - files, err := models.GetReposFiles(params["username"], params["reponame"], "HEAD", "/") - if err != nil { - data["ErrorMsg"] = err - log.Error("repo.List: %v", err) - r.HTML(200, "base/error", data) - return - } - - data["Files"] = files - r.HTML(200, "repo/repo", data) -} - func List(req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { u := auth.SignedInUser(session) if u != nil { diff --git a/routers/repo/single.go b/routers/repo/single.go index be27db8e05..811aed3993 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -1,16 +1,17 @@ package repo import ( + "net/http" + "github.com/codegangsta/martini" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" "github.com/martini-contrib/render" "github.com/martini-contrib/sessions" - "net/http" + "github.com/qiniu/log" ) - func Single(params martini.Params, req *http.Request, r render.Render, data base.TmplData, session sessions.Session) { var ( user *models.User @@ -52,5 +53,14 @@ func Single(params martini.Params, req *http.Request, r render.Render, data base data["RepositoryLink"] = data["Title"] data["IsRepoToolbarSource"] = true + files, err := models.GetReposFiles(params["username"], params["reponame"], "HEAD", "/") + if err != nil { + data["ErrorMsg"] = err + log.Error("repo.List: %v", err) + r.HTML(200, "base/error", data) + return + } + + data["Files"] = files r.HTML(200, "repo/single", data) } diff --git a/templates/repo/repo.tmpl b/templates/repo/repo.tmpl deleted file mode 100644 index 5ae3f25c16..0000000000 --- a/templates/repo/repo.tmpl +++ /dev/null @@ -1,10 +0,0 @@ -{{template "base/head" .}} -{{template "base/navbar" .}} -
- -
-{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index ef812f8249..9d4a24f851 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -33,6 +33,10 @@ {{template "repo/toolbar" .}}
- repo single dashboard +
{{template "base/footer" .}} \ No newline at end of file diff --git a/web.go b/web.go index c8b7ed0d49..c204131662 100644 --- a/web.go +++ b/web.go @@ -70,8 +70,6 @@ func runWeb(*cli.Context) { m.Get("/user/:username", auth.SignInRequire(false), user.Profile) - m.Get("/:username/:reponame", repo.Repo) - m.Any("/repo/create", auth.SignInRequire(true), binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create) m.Any("/repo/delete", auth.SignInRequire(true), repo.Delete) m.Any("/repo/list", auth.SignInRequire(false), repo.List)