From f65d8f9144436d11cdce2614b3520271b31ae288 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Thu, 13 Mar 2014 13:07:07 +0800 Subject: [PATCH] single repository page ui, add spec handler to get repo --- routers/repo/repo.go | 16 ---------------- routers/repo/single.go | 14 +++++++++++++- templates/repo/repo.tmpl | 10 ---------- templates/repo/single.tmpl | 7 ++++++- 4 files changed, 19 insertions(+), 28 deletions(-) delete mode 100644 templates/repo/repo.tmpl diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 644403452..5769aff7c 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 322f6ce87..02fd34212 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -1,14 +1,26 @@ package repo import ( + "github.com/codegangsta/martini" + "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/log" "github.com/martini-contrib/render" ) -func Single(r render.Render, data base.TmplData) { +func Single(params martini.Params, r render.Render, data base.TmplData) { if !data["IsRepositoryValid"].(bool) { return } + + 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 data["IsRepoToolbarSource"] = true r.HTML(200, "repo/single", data) } diff --git a/templates/repo/repo.tmpl b/templates/repo/repo.tmpl deleted file mode 100644 index 5ae3f25c1..000000000 --- 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 ef812f824..28bbea635 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -33,6 +33,11 @@ {{template "repo/toolbar" .}}
- repo single dashboard +

Source Files:

+
{{template "base/footer" .}} \ No newline at end of file