summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-13 12:16:51 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-13 12:16:51 +0800
commit555c8f1d919eae951bf7f75f4bc6a150ec04b9a6 (patch)
treeba7626e08bbb06ea4261bf6b41fcd1b82369d3ee /routers
parent4fff38856e784cb1c2c8115a7c7e013f42f7d8d8 (diff)
parent9b845c11150102894a8bb453d86a335a7c2a64b8 (diff)
downloadgitea-555c8f1d919eae951bf7f75f4bc6a150ec04b9a6.tar.gz
gitea-555c8f1d919eae951bf7f75f4bc6a150ec04b9a6.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/repo.go25
1 files changed, 21 insertions, 4 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 62352f76cf..6444034525 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -5,9 +5,9 @@
package repo
import (
- "fmt"
"net/http"
+ "github.com/codegangsta/martini"
"github.com/martini-contrib/render"
"github.com/martini-contrib/sessions"
@@ -87,12 +87,29 @@ func Delete(req *http.Request, r render.Render, data base.TmplData, session sess
}
}
-func List(req *http.Request, r render.Render, data base.TmplData, session sessions.Session) {
- data["Title"] = "Repositories"
+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 {
+ r.Redirect("/")
+ return
+ }
+
+ data["Title"] = "Repositories"
repos, err := models.GetRepositories(u)
- fmt.Println("repos", repos)
if err != nil {
data["ErrorMsg"] = err
log.Error("repo.List: %v", err)