commits.templ RawHistoryFolder
1// SPDX-License-Identifier: AGPL-3.0-or-later
2
3package web
4
5// Commits is the history of a ref, or of a path at a ref: the commits of the
6// page grouped by day, and the way to the older ones.
7templ Commits(l Layout, p CommitsPage) {
8 @Shell(l, commitsRail(p)) {
9 <div class="filter">
10 <label for="commit-filter" class="sr">filter</label>
11 <input
12 id="commit-filter"
13 type="search"
14 data-filter=".days tr"
15 data-groups=".days section"
16 placeholder="Filter by subject, sha or author…"
17 autocomplete="off"
18 hx-on:input="ermite.filter(this)"
19 />
20 </div>
21 if p.Path != "" {
22 <p class="lede dim">history of <code>{ p.Path }</code> at { p.Ref }</p>
23 }
24 if p.Live {
25 @LiveSlot("commits-head")
26 }
27 <div class="days">
28 for _, g := range p.Days {
29 <section aria-label={ g.Day }>
30 <h2 class="rule-h"><span>{ g.Day }</span></h2>
31 @CommitRows(g.Rows)
32 </section>
33 }
34 </div>
35 if len(p.Days) == 0 {
36 <p class="lede dim">no commits.</p>
37 }
38 if p.Older != "" || p.Newest != "" {
39 <nav class="pager" aria-label="Pages">
40 if p.Newest != "" {
41 <a class="btn" href={ templ.SafeURL(p.Newest) }>← Newest</a>
42 } else {
43 <span class="btn" aria-disabled="true">← Newest</span>
44 }
45 if p.Older != "" {
46 <a class="btn" href={ templ.SafeURL(p.Older) } rel="next">Older →</a>
47 } else {
48 <span class="btn" aria-disabled="true">Older →</span>
49 }
50 </nav>
51 }
52 }
53}
54
55templ commitsRail(p CommitsPage) {
56 <section aria-labelledby="r-hist">
57 <h2 id="r-hist">History</h2>
58 <dl class="kv">
59 <dt>ref</dt>
60 <dd>{ p.Ref }</dd>
61 <dt>on page</dt>
62 <dd>{ itoa(p.Count) }</dd>
63 if p.Path != "" {
64 <dt>path</dt>
65 <dd>{ p.Path }</dd>
66 }
67 if p.Open != nil {
68 <dt>file</dt>
69 <dd><a href={ templ.SafeURL(p.Open.Href) }>{ p.Open.Label }</a></dd>
70 }
71 </dl>
72 </section>
73 <section aria-labelledby="r-refs">
74 <h2 id="r-refs">Refs on this page</h2>
75 if len(p.Refs) > 0 {
76 <nav class="outline" aria-label="Refs on this page">
77 for _, r := range p.Refs {
78 <a href={ templ.SafeURL(r.Href) }>{ r.Label }</a>
79 }
80 </nav>
81 } else {
82 <p class="dim">no tag or branch head here</p>
83 }
84 </section>
85}