v0.17.0 ab8e178

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}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 4

Tags 45

↑↓ moveenter openesc close