From 757f360949989214a9161f17a82aedf2b647457a Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 19 Mar 2014 13:14:56 -0400 Subject: [PATCH] Render data in commit list page --- modules/base/template.go | 3 +++ routers/repo/repo.go | 6 +++--- routers/repo/single.go | 2 ++ templates/repo/commits.tmpl | 43 +++++++++++++------------------------ 4 files changed, 23 insertions(+), 31 deletions(-) diff --git a/modules/base/template.go b/modules/base/template.go index 5268da64903..e596d1dada6 100644 --- a/modules/base/template.go +++ b/modules/base/template.go @@ -58,4 +58,7 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{ "Mail2Domain": func(mail string) string { return "mail." + strings.Split(mail, "@")[1] }, + "SubStr": func(str string, start, length int) string { + return str[start : start+length] + }, } diff --git a/routers/repo/repo.go b/routers/repo/repo.go index fb54d4ef8ba..b38473b18a0 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -13,11 +13,11 @@ import ( func Create(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Data["Title"] = "Create repository" + ctx.Data["PageIsNewRepo"] = true // For navbar arrow. + ctx.Data["LanguageIgns"] = models.LanguageIgns + ctx.Data["Licenses"] = models.Licenses if ctx.Req.Method == "GET" { - ctx.Data["PageIsNewRepo"] = true // For navbar arrow. - ctx.Data["LanguageIgns"] = models.LanguageIgns - ctx.Data["Licenses"] = models.Licenses ctx.HTML(200, "repo/create", ctx.Data) return } diff --git a/routers/repo/single.go b/routers/repo/single.go index 0bfc8ffb24a..285c5277af8 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -186,6 +186,8 @@ func Commits(ctx *middleware.Context, params martini.Params) { ctx.Error(404) return } + ctx.Data["Username"] = params["username"] + ctx.Data["Reponame"] = params["reponame"] ctx.Data["Commits"] = commits ctx.HTML(200, "repo/commits", ctx.Data) } diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 53c14d364ab..04ca19afc88 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -13,41 +13,28 @@ - - - - - - + + + + + + + {{ $username := .Username}} + {{ $reponame := .Reponame}} + {{$r := List .Commits}} + {{range $r}} - - - - - - - - - - - - - - - - + + + + + {{end}} - {{template "base/footer" .}} \ No newline at end of file