v0.33.0 cf26365

releases.templ RawHistoryFolder

1package web
2
3// ReleaseBadges are textual as well as visual, including the computed latest.
4templ ReleaseBadges(r ReleaseRow) {
5	if r.Draft {
6		<span class="pill">Draft</span>
7	}
8	if r.Prerelease {
9		<span class="pill">Pre-release</span>
10	}
11	if r.Latest {
12		<span class="pill">Latest</span>
13	}
14}
15
16templ Releases(l Layout, p ReleaseListPage) {
17	@Shell(l, nil) {
18		<h1>Releases</h1>
19		if len(p.Rows) == 0 {
20			<p class="dim">no releases yet.</p>
21		} else {
22			<table class="list" aria-label="Releases">
23				<thead><tr><th>tag</th><th>title</th><th>published</th><th>assets</th></tr></thead>
24				<tbody>
25					for _, r := range p.Rows {
26						<tr>
27							<td><a href={ templ.SafeURL(r.Href) }>{ r.Tag }</a></td>
28							<td>{ r.Title } @ReleaseBadges(r)</td>
29							<td>{ r.Published }</td><td>{ itoa(r.AssetCount) }</td>
30						</tr>
31					}
32				</tbody>
33			</table>
34		}
35		if p.Older != "" {
36			<p class="more"><a href={ templ.SafeURL(p.Older) } rel="next">older releases</a></p>
37		}
38	}
39}
40
41templ ReleaseDetail(l Layout, p ReleaseDetailPage) {
42	@Shell(l, nil) {
43		<h1>{ p.Title }</h1>
44		<p>
45			<span class="pill">{ p.Tag }</span> @ReleaseBadges(p.ReleaseRow)
46			if p.SHA != "" {
47				<a href={ templ.SafeURL(p.CommitHref) }><code>{ p.SHA }</code></a>
48			}
49			<span class="dim">{ p.Published }</span>
50		</p>
51		<div class="md">@templ.Raw(string(p.Notes))</div>
52		<h2>Assets</h2>
53		if len(p.Assets) == 0 {
54			<p class="dim">no assets.</p>
55		} else {
56			<table class="list" aria-label="Release assets">
57				<thead><tr><th>name</th><th>size</th><th>content type</th></tr></thead>
58				<tbody>
59					for _, a := range p.Assets {
60						<tr><td><a href={ templ.SafeURL(a.Href) } download>{ a.Name }</a></td><td>{ a.Size }</td><td>{ a.ContentType }</td></tr>
61					}
62				</tbody>
63			</table>
64		}
65		<p><a href={ templ.SafeURL(p.SourceHref) }>Source</a></p>
66	}
67}

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 2

Tags 45

↑↓ moveenter openesc close