commits.html

 1{{define "content"}}
 2<nav aria-label="breadcrumb">
 3  <ul>
 4    <li><a href="/{{.Repo.Name}}">{{.Repo.Name}}</a></li>
 5    <li>{{.Ref}}</li>
 6  </ul>
 7</nav>
 8
 9<section aria-labelledby="commits-heading">
10  <h2 id="commits-heading">Commit log</h2>
11
12  {{if .Commits}}
13  {{range .Commits}}
14  <article aria-labelledby="commit-{{.ID | shortHash}}">
15    <h3 id="commit-{{.ID | shortHash}}">
16      <code><a href="/{{$.Repo.Name}}/commit/{{.ID}}">{{.ID | shortHash}}</a></code>
17      {{.Message | commitSubject}}
18    </h3>
19    {{$body := .Message | commitBody}}
20    {{if $body}}
21    <details>
22      <summary>Click to expand commit body</summary>
23      <pre>{{$body}}</pre>
24    </details>
25    {{end}}
26     <p>
27       {{ $names := . | attributionNames }}
28       {{ $nlen := len $names }}
29       {{ range $i, $n := $names }}
30         {{ if gt $i 0 }}
31           {{ if eq $nlen 2 }} and {{ else if eq $i (sub $nlen 1) }}, and {{ else }}, {{ end }}
32         {{ end }}
33         <strong>{{$n}}</strong>
34       {{ end }}
35       created
36       <time datetime="{{.Author.When | rfc3339}}" data-tooltip="{{.Author.When | formatDate}}">{{.Author.When | relativeTime}}</time>
37     </p>
38  </article>
39  {{end}}
40
41  {{if or .HasPrevPage .HasNextPage}}
42  <nav aria-label="Pagination">
43    <p>Page {{.Page}} of {{.TotalPages}}</p>
44    <ul>
45      {{if .HasPrevPage}}
46      <li>
47        <a href="/{{.Repo.Name}}/commits/{{.Ref}}?page={{dec .Page}}" rel="prev"
48          >Previous page</a
49        >
50      </li>
51      {{end}}
52      {{if .HasNextPage}}
53      <li>
54        <a href="/{{.Repo.Name}}/commits/{{.Ref}}?page={{inc .Page}}" rel="next"
55          >Next page</a
56        >
57      </li>
58      {{end}}
59    </ul>
60  </nav>
61  {{end}}
62  {{else}}
63  <p>No commits yet</p>
64  {{end}}
65</section>
66{{end}}