This commit is contained in:
Unknown 2014-03-17 01:14:05 -04:00
parent 0f68930892
commit 95cb7cb2ad
1 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"strings" "strings"
"github.com/codegangsta/martini" "github.com/codegangsta/martini"
"github.com/slene/blackfriday"
"github.com/gogits/gogs/models" "github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/middleware"
@ -22,6 +23,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
params["branchname"] = "master" params["branchname"] = "master"
} }
// Directory and file list.
treename := params["_1"] treename := params["_1"]
files, err := models.GetReposFiles(params["username"], params["reponame"], files, err := models.GetReposFiles(params["username"], params["reponame"],
params["branchname"], treename) params["branchname"], treename)
@ -33,6 +35,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
ctx.Data["Reponame"] = params["reponame"] ctx.Data["Reponame"] = params["reponame"]
ctx.Data["Branchname"] = params["branchname"] ctx.Data["Branchname"] = params["branchname"]
// Branches.
brs, err := models.GetBranches(params["username"], params["reponame"]) brs, err := models.GetBranches(params["username"], params["reponame"])
if err != nil { if err != nil {
ctx.Handle(200, "repo.Single", err) ctx.Handle(200, "repo.Single", err)
@ -50,6 +53,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
} }
} }
// Latest commit.
commit, err := models.GetLastestCommit(params["username"], params["reponame"]) commit, err := models.GetLastestCommit(params["username"], params["reponame"])
if err != nil { if err != nil {
ctx.Handle(200, "repo.Single", err) ctx.Handle(200, "repo.Single", err)
@ -57,6 +61,15 @@ func Single(ctx *middleware.Context, params martini.Params) {
} }
ctx.Data["LatestCommit"] = commit ctx.Data["LatestCommit"] = commit
// README.
// for _, f := range files {
// if f.Name == "README.md" {
// ctx.Data["ReadmeName"] = "README.md"
// ctx.Data["ReadmeContent"] =
// break
// }
// }
ctx.Data["Paths"] = Paths ctx.Data["Paths"] = Paths
ctx.Data["Treenames"] = treenames ctx.Data["Treenames"] = treenames
ctx.Data["IsRepoToolbarSource"] = true ctx.Data["IsRepoToolbarSource"] = true