diff options
author | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-03-13 13:07:07 +0800 |
---|---|---|
committer | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-03-13 13:07:07 +0800 |
commit | f65d8f9144436d11cdce2614b3520271b31ae288 (patch) | |
tree | 06ad70508b7cd7143bf71b72ec53be6da1df8e1a /routers | |
parent | b1fe498eb975d112b06814253f9b9e8dc561d91f (diff) | |
download | gitea-f65d8f9144436d11cdce2614b3520271b31ae288.tar.gz gitea-f65d8f9144436d11cdce2614b3520271b31ae288.zip |
single repository page ui, add spec handler to get repo
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/repo.go | 16 | ||||
-rw-r--r-- | routers/repo/single.go | 14 |
2 files changed, 13 insertions, 17 deletions
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 322f6ce87f..02fd34212a 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) } |