diff options
-rw-r--r-- | modules/base/template.go | 3 | ||||
-rw-r--r-- | routers/repo/repo.go | 6 | ||||
-rw-r--r-- | routers/repo/single.go | 2 | ||||
-rw-r--r-- | 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 5268da6490..e596d1dada 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 fb54d4ef8b..b38473b18a 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 0bfc8ffb24..285c5277af 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 53c14d364a..04ca19afc8 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -13,41 +13,28 @@ </div> <table class="panel-footer table commit-list table table-striped"> <thead> - <tr> - <th class="author">Author</th> - <th class="sha">Commit</th> - <th class="message">Message</th> - <th class="date">Date</th> - </tr> + <tr> + <th class="author">Author</th> + <th class="sha">Commit</th> + <th class="message">Message</th> + <th class="date">Date</th> + </tr> </thead> <tbody> + {{ $username := .Username}} + {{ $reponame := .Reponame}} + {{$r := List .Commits}} + {{range $r}} <tr> - <td class="author"><img class="avatar" src="#" alt=""/>CommitUser</td> - <td class="sha"><a class="label label-success" href="#">d91b380</a></td> - <td class="message">Fix Synchronize to delete service objects in subduers upon move</td> - <td class="date">3 years ago</td> - </tr> - <tr> - <td class="author"><img class="avatar" src="#" alt=""/>CommitUser</td> - <td class="sha"><a class="label label-success" href="#">d91b380</a></td> - <td class="message">Fix Synchronize to delete service objects in subduers upon move</td> - <td class="date">3 years ago</td> - </tr> - <tr> - <td class="author"><img class="avatar" src="#" alt=""/>CommitUser</td> - <td class="sha"><a class="label label-success" href="#">d91b380</a></td> - <td class="message">Fix Synchronize to delete service objects in subduers upon move</td> - <td class="date">3 years ago</td> + <td class="author"><img class="avatar" src="{{AvatarLink .Committer.Email}}" alt=""/>{{.Committer.Name}}</td> + <td class="sha"><a class="label label-success" href="/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 7}} </a></td> + <td class="message">{{.Message}} </td> + <td class="date">{{TimeSince .Committer.When}}</td> </tr> + {{end}} </tbody> </table> </div> - <ul> - {{$r := List .Commits}} - {{range $r}} - <li>{{.Committer.Name}} - {{.Id}} - {{.Message}} - {{.Committer.When}}</li> - {{end}} - </ul> </div> </div> {{template "base/footer" .}}
\ No newline at end of file |