v0.2.0 41cf2ec

fragments.templ RawHistoryFolder

1// SPDX-License-Identifier: AGPL-3.0-or-later
2
3package web
4
5// The fragments of the live updates (events.go). Each is a top-level element
6// with an id: the page swaps the element that has the same id.
7
8// FactValue is the value of a fact; its id, when it has one, is the target of
9// the live updates ("last push").
10templ FactValue(f Fact) {
11	<dd
12		if f.ID != "" {
13			id={ f.ID }
14		}
15	>
16		if f.Time != "" {
17			<time datetime={ f.Time }>{ f.Val }</time>
18		} else {
19			{ f.Val }
20		}
21	</dd>
22}
23
24// RepoGone replaces the row of a repository that is deleted or not visible
25// any more; the page removes the element.
26templ RepoGone(id string) {
27	<tr id={ id } data-gone hidden></tr>
28}
29
30// RefsBody is the rows of the refs table.
31templ RefsBody(p RefsPage) {
32	<tbody id="ref-rows" data-rows>
33		for _, b := range p.Branches {
34			@refRow("branch", b)
35		}
36		for _, t := range p.Tags {
37			@refRow("tag", t)
38		}
39	</tbody>
40}
41
42// RefsKV is the facts of the rail of the refs page.
43templ RefsKV(p RefsPage) {
44	<dl class="kv" id="refs-kv">
45		<dt>default</dt>
46		<dd>{ p.Default }</dd>
47		<dt>branches</dt>
48		<dd>{ itoa(len(p.Branches)) }</dd>
49		<dt>tags</dt>
50		<dd>{ itoa(len(p.Tags)) }</dd>
51		if p.Latest != "" {
52			<dt>latest tag</dt>
53			<dd>{ p.Latest }</dd>
54		}
55	</dl>
56}
57
58// CommitsSlot is the place of the banner of the commits page, empty.
59templ CommitsSlot() {
60	<div id="commits-head"></div>
61}
62
63// CommitsBanner announces new commits on the branch the page lists. It links
64// to the first page of the branch.
65templ CommitsBanner(text, href string) {
66	<div id="commits-head" class="live-banner" role="status">
67		<a href={ templ.SafeURL(href) }>{ text }</a>
68	</div>
69}
70
71// MRNotice tells a merge request page that it is out of date. The empty slot
72// of the page has the same id, so the first notice replaces it.
73templ MRNotice(text, href string) {
74	<div id="mr-notice" class="live-banner" role="status">
75		<a href={ templ.SafeURL(href) }>{ text }</a>
76	</div>
77}
78
79// Live is the connection state of the event stream, in the status bar.
80// Without a stream it reads "offline" and does nothing. The events of the
81// stream are fragments that ermiteLive (ermite.js) swaps in the page.
82templ Live(l Layout) {
83	if l.Live && l.LiveURL != "" {
84		<span
85			class="st-live"
86			data-state="offline"
87			role="status"
88			hx-sse:connect={ l.LiveURL }
89			hx-swap="none"
90			:text="data.state"
91			:title="data.state === 'live' ? 'receiving updates over SSE' : 'not connected to the event stream'"
92			hx-on="htmx:sse:after:connection -> data.state = 'live';
93           htmx:sse:close, htmx:sse:error -> data.state = 'offline';
94           home-list, repo-last-push, refs-list, commits-head, mr-notice -> ermiteLive.swap(event.detail.data);
95           gap -> ermiteLive.reload()"
96		>offline</span>
97	} else {
98		<span class="st-live" data-state="offline" role="status" title="not connected to the event stream">offline</span>
99	}
100}

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 3

Tags 44

↑↓ moveenter openesc close