1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-30 13:13:10 +00:00

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 {
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) {
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
}

View file

@ -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)
}

View file

@ -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" .}}