Browse Source

Render data in commit list page

pull/33/head
Unknown 11 years ago
parent
commit
757f360949
  1. 3
      modules/base/template.go
  2. 4
      routers/repo/repo.go
  3. 2
      routers/repo/single.go
  4. 31
      templates/repo/commits.tmpl

3
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]
},
}

4
routers/repo/repo.go

@ -13,11 +13,11 @@ import (
func Create(ctx *middleware.Context, form auth.CreateRepoForm) {
ctx.Data["Title"] = "Create repository"
if ctx.Req.Method == "GET" {
ctx.Data["PageIsNewRepo"] = true // For navbar arrow.
ctx.Data["LanguageIgns"] = models.LanguageIgns
ctx.Data["Licenses"] = models.Licenses
if ctx.Req.Method == "GET" {
ctx.HTML(200, "repo/create", ctx.Data)
return
}

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

31
templates/repo/commits.tmpl

@ -21,33 +21,20 @@
</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" .}}
Loading…
Cancel
Save