v0.5.0 bfab294

tree.templ RawHistoryFolder

1// SPDX-License-Identifier: AGPL-3.0-or-later
2
3package web
4
5// Tree is a directory: the filter, the entries with their last commit, the
6// notes on what is left out, and the README of the directory below.
7templ Tree(l Layout, p TreePage) {
8	@Shell(l, nil) {
9		<div class="filter">
10			<label for="tree-filter" class="sr">filter</label>
11			<input
12				id="tree-filter"
13				type="search"
14				data-filter
15				placeholder="Filter this directory…"
16				autocomplete="off"
17				hx-on:input="let t = this.value.toLowerCase(); q('#tree-rows > tr').arr().forEach(r => r.hidden = !r.textContent.toLowerCase().includes(t)); take('data-cursor', '#tree-rows > tr:not([hidden])')"
18			/>
19		</div>
20		<table class="list tree" aria-label="Entries">
21			<thead>
22				<tr><th class="cur"></th><th class="c-kind"></th><th class="c-name">name</th><th class="c-size">size</th><th class="c-sub">last commit</th><th class="c-who">author</th><th class="c-when">date</th></tr>
23			</thead>
24			<tbody id="tree-rows" data-rows>
25				for _, r := range p.Rows {
26					@TreeRowView(r)
27				}
28			</tbody>
29		</table>
30		if len(p.Rows) == 0 {
31			<p class="lede dim">this directory is empty.</p>
32		}
33		for _, n := range p.Notes {
34			<p class="note">{ n }</p>
35		}
36		if p.Readme != nil {
37			@ReadmeCard(*p.Readme)
38		}
39	}
40}
41
42// TreeRowView is one entry of a directory. Glyph: ▾ directory, @ symbolic
43// link, + submodule, · file.
44templ TreeRowView(r TreeRow) {
45	<tr data-cursor?={ r.Cursor }>
46		<td class="cur" aria-hidden="true"></td>
47		<td class="c-kind" aria-hidden="true">{ r.Glyph }</td>
48		<td class="c-name">
49			if r.Href != "" {
50				<a href={ templ.SafeURL(r.Href) }>{ r.Name }</a>
51			} else {
52				{ r.Name }
53			}
54		</td>
55		<td class="c-size num dim">{ r.Size }</td>
56		<td class="c-sub dim">
57			if r.CHref != "" {
58				<a href={ templ.SafeURL(r.CHref) }>{ r.Subject }</a>
59			}
60		</td>
61		<td class="c-who dim">{ r.Author }</td>
62		<td class="c-when nowrap dim">
63			if r.WhenAt != "" {
64				<time datetime={ r.WhenAt } title={ r.WhenAt }>{ r.When }</time>
65			}
66		</td>
67	</tr>
68}

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