Render data in commit list page

This commit is contained in:
Unknown 2014-03-19 13:14:56 -04:00
parent 04b0ba6852
commit 757f360949
4 changed files with 23 additions and 31 deletions

View File

@ -58,4 +58,7 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"Mail2Domain": func(mail string) string { "Mail2Domain": func(mail string) string {
return "mail." + strings.Split(mail, "@")[1] return "mail." + strings.Split(mail, "@")[1]
}, },
"SubStr": func(str string, start, length int) string {
return str[start : start+length]
},
} }

View File

@ -13,11 +13,11 @@ import (
func Create(ctx *middleware.Context, form auth.CreateRepoForm) { func Create(ctx *middleware.Context, form auth.CreateRepoForm) {
ctx.Data["Title"] = "Create repository" 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" { 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) ctx.HTML(200, "repo/create", ctx.Data)
return return
} }

View File

@ -186,6 +186,8 @@ func Commits(ctx *middleware.Context, params martini.Params) {
ctx.Error(404) ctx.Error(404)
return return
} }
ctx.Data["Username"] = params["username"]
ctx.Data["Reponame"] = params["reponame"]
ctx.Data["Commits"] = commits ctx.Data["Commits"] = commits
ctx.HTML(200, "repo/commits", ctx.Data) ctx.HTML(200, "repo/commits", ctx.Data)
} }

View File

@ -13,41 +13,28 @@
</div> </div>
<table class="panel-footer table commit-list table table-striped"> <table class="panel-footer table commit-list table table-striped">
<thead> <thead>
<tr> <tr>
<th class="author">Author</th> <th class="author">Author</th>
<th class="sha">Commit</th> <th class="sha">Commit</th>
<th class="message">Message</th> <th class="message">Message</th>
<th class="date">Date</th> <th class="date">Date</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{ $username := .Username}}
{{ $reponame := .Reponame}}
{{$r := List .Commits}}
{{range $r}}
<tr> <tr>
<td class="author"><img class="avatar" src="#" alt=""/>CommitUser</td> <td class="author"><img class="avatar" src="{{AvatarLink .Committer.Email}}" alt=""/>{{.Committer.Name}}</td>
<td class="sha"><a class="label label-success" href="#">d91b380</a></td> <td class="sha"><a class="label label-success" href="/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 7}} </a></td>
<td class="message">Fix Synchronize to delete service objects in subduers upon move</td> <td class="message">{{.Message}} </td>
<td class="date">3 years ago</td> <td class="date">{{TimeSince .Committer.When}}</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>
</tr> </tr>
{{end}}
</tbody> </tbody>
</table> </table>
</div> </div>
<ul>
{{$r := List .Commits}}
{{range $r}}
<li>{{.Committer.Name}} - {{.Id}} - {{.Message}} - {{.Committer.When}}</li>
{{end}}
</ul>
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}