branches.html

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