v0.3.0 9fdf386

tree_templ.go RawHistoryFolder

1// Code generated by templ - DO NOT EDIT.
2
3// templ: version: v0.3.1020
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6package web
7
8//lint:file-ignore SA4006 This context is only used if a nested component is present.
9
10import "github.com/a-h/templ"
11import templruntime "github.com/a-h/templ/runtime"
12
13// Tree is a directory: the filter, the entries with their last commit, the
14// notes on what is left out, and the README of the directory below.
15func Tree(l Layout, p TreePage) templ.Component {
16	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
17		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
18		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
19			return templ_7745c5c3_CtxErr
20		}
21		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
22		if !templ_7745c5c3_IsBuffer {
23			defer func() {
24				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
25				if templ_7745c5c3_Err == nil {
26					templ_7745c5c3_Err = templ_7745c5c3_BufErr
27				}
28			}()
29		}
30		ctx = templ.InitializeContext(ctx)
31		templ_7745c5c3_Var1 := templ.GetChildren(ctx)
32		if templ_7745c5c3_Var1 == nil {
33			templ_7745c5c3_Var1 = templ.NopComponent
34		}
35		ctx = templ.ClearChildren(ctx)
36		templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
37			templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
38			templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
39			if !templ_7745c5c3_IsBuffer {
40				defer func() {
41					templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
42					if templ_7745c5c3_Err == nil {
43						templ_7745c5c3_Err = templ_7745c5c3_BufErr
44					}
45				}()
46			}
47			ctx = templ.InitializeContext(ctx)
48			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"filter\"><label for=\"tree-filter\">filter&gt;</label> <input id=\"tree-filter\" type=\"search\" data-filter placeholder=\"this directory  ( / )\" autocomplete=\"off\" 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])')\"></div><table class=\"list tree\" aria-label=\"Entries\"><thead><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></thead> <tbody id=\"tree-rows\" data-rows>")
49			if templ_7745c5c3_Err != nil {
50				return templ_7745c5c3_Err
51			}
52			for _, r := range p.Rows {
53				templ_7745c5c3_Err = TreeRowView(r).Render(ctx, templ_7745c5c3_Buffer)
54				if templ_7745c5c3_Err != nil {
55					return templ_7745c5c3_Err
56				}
57			}
58			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</tbody></table>")
59			if templ_7745c5c3_Err != nil {
60				return templ_7745c5c3_Err
61			}
62			if len(p.Rows) == 0 {
63				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<p class=\"lede dim\">this directory is empty.</p>")
64				if templ_7745c5c3_Err != nil {
65					return templ_7745c5c3_Err
66				}
67			}
68			for _, n := range p.Notes {
69				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<p class=\"note\">")
70				if templ_7745c5c3_Err != nil {
71					return templ_7745c5c3_Err
72				}
73				var templ_7745c5c3_Var3 string
74				templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(n)
75				if templ_7745c5c3_Err != nil {
76					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 34, Col: 22}
77				}
78				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
79				if templ_7745c5c3_Err != nil {
80					return templ_7745c5c3_Err
81				}
82				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</p>")
83				if templ_7745c5c3_Err != nil {
84					return templ_7745c5c3_Err
85				}
86			}
87			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " ")
88			if templ_7745c5c3_Err != nil {
89				return templ_7745c5c3_Err
90			}
91			if p.Readme != nil {
92				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<h2 class=\"rule-h\"><span>")
93				if templ_7745c5c3_Err != nil {
94					return templ_7745c5c3_Err
95				}
96				var templ_7745c5c3_Var4 string
97				templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(p.Readme.Name)
98				if templ_7745c5c3_Err != nil {
99					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 37, Col: 43}
100				}
101				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
102				if templ_7745c5c3_Err != nil {
103					return templ_7745c5c3_Err
104				}
105				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</span></h2>")
106				if templ_7745c5c3_Err != nil {
107					return templ_7745c5c3_Err
108				}
109				templ_7745c5c3_Err = ReadmeView(*p.Readme).Render(ctx, templ_7745c5c3_Buffer)
110				if templ_7745c5c3_Err != nil {
111					return templ_7745c5c3_Err
112				}
113			}
114			return nil
115		})
116		templ_7745c5c3_Err = Shell(l, nil).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
117		if templ_7745c5c3_Err != nil {
118			return templ_7745c5c3_Err
119		}
120		return nil
121	})
122}
123
124// TreeRowView is one entry of a directory. Glyph: ▾ directory, @ symbolic
125// link, + submodule, · file.
126func TreeRowView(r TreeRow) templ.Component {
127	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
128		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
129		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
130			return templ_7745c5c3_CtxErr
131		}
132		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
133		if !templ_7745c5c3_IsBuffer {
134			defer func() {
135				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
136				if templ_7745c5c3_Err == nil {
137					templ_7745c5c3_Err = templ_7745c5c3_BufErr
138				}
139			}()
140		}
141		ctx = templ.InitializeContext(ctx)
142		templ_7745c5c3_Var5 := templ.GetChildren(ctx)
143		if templ_7745c5c3_Var5 == nil {
144			templ_7745c5c3_Var5 = templ.NopComponent
145		}
146		ctx = templ.ClearChildren(ctx)
147		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<tr")
148		if templ_7745c5c3_Err != nil {
149			return templ_7745c5c3_Err
150		}
151		if r.Cursor {
152			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " data-cursor")
153			if templ_7745c5c3_Err != nil {
154				return templ_7745c5c3_Err
155			}
156		}
157		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "><td class=\"cur\" aria-hidden=\"true\"></td><td class=\"c-kind\" aria-hidden=\"true\">")
158		if templ_7745c5c3_Err != nil {
159			return templ_7745c5c3_Err
160		}
161		var templ_7745c5c3_Var6 string
162		templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(r.Glyph)
163		if templ_7745c5c3_Err != nil {
164			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 48, Col: 49}
165		}
166		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
167		if templ_7745c5c3_Err != nil {
168			return templ_7745c5c3_Err
169		}
170		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</td><td class=\"c-name\">")
171		if templ_7745c5c3_Err != nil {
172			return templ_7745c5c3_Err
173		}
174		if r.Href != "" {
175			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<a href=\"")
176			if templ_7745c5c3_Err != nil {
177				return templ_7745c5c3_Err
178			}
179			var templ_7745c5c3_Var7 templ.SafeURL
180			templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(r.Href))
181			if templ_7745c5c3_Err != nil {
182				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 51, Col: 35}
183			}
184			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
185			if templ_7745c5c3_Err != nil {
186				return templ_7745c5c3_Err
187			}
188			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "\">")
189			if templ_7745c5c3_Err != nil {
190				return templ_7745c5c3_Err
191			}
192			var templ_7745c5c3_Var8 string
193			templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
194			if templ_7745c5c3_Err != nil {
195				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 51, Col: 46}
196			}
197			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
198			if templ_7745c5c3_Err != nil {
199				return templ_7745c5c3_Err
200			}
201			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</a>")
202			if templ_7745c5c3_Err != nil {
203				return templ_7745c5c3_Err
204			}
205		} else {
206			var templ_7745c5c3_Var9 string
207			templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
208			if templ_7745c5c3_Err != nil {
209				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 53, Col: 12}
210			}
211			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
212			if templ_7745c5c3_Err != nil {
213				return templ_7745c5c3_Err
214			}
215		}
216		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</td><td class=\"c-size num dim\">")
217		if templ_7745c5c3_Err != nil {
218			return templ_7745c5c3_Err
219		}
220		var templ_7745c5c3_Var10 string
221		templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(r.Size)
222		if templ_7745c5c3_Err != nil {
223			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 56, Col: 37}
224		}
225		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
226		if templ_7745c5c3_Err != nil {
227			return templ_7745c5c3_Err
228		}
229		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</td><td class=\"c-sub dim\">")
230		if templ_7745c5c3_Err != nil {
231			return templ_7745c5c3_Err
232		}
233		if r.CHref != "" {
234			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<a href=\"")
235			if templ_7745c5c3_Err != nil {
236				return templ_7745c5c3_Err
237			}
238			var templ_7745c5c3_Var11 templ.SafeURL
239			templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(r.CHref))
240			if templ_7745c5c3_Err != nil {
241				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 59, Col: 36}
242			}
243			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
244			if templ_7745c5c3_Err != nil {
245				return templ_7745c5c3_Err
246			}
247			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\">")
248			if templ_7745c5c3_Err != nil {
249				return templ_7745c5c3_Err
250			}
251			var templ_7745c5c3_Var12 string
252			templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(r.Subject)
253			if templ_7745c5c3_Err != nil {
254				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 59, Col: 50}
255			}
256			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
257			if templ_7745c5c3_Err != nil {
258				return templ_7745c5c3_Err
259			}
260			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</a>")
261			if templ_7745c5c3_Err != nil {
262				return templ_7745c5c3_Err
263			}
264		}
265		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</td><td class=\"c-who dim\">")
266		if templ_7745c5c3_Err != nil {
267			return templ_7745c5c3_Err
268		}
269		var templ_7745c5c3_Var13 string
270		templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(r.Author)
271		if templ_7745c5c3_Err != nil {
272			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 62, Col: 34}
273		}
274		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
275		if templ_7745c5c3_Err != nil {
276			return templ_7745c5c3_Err
277		}
278		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</td><td class=\"c-when nowrap dim\">")
279		if templ_7745c5c3_Err != nil {
280			return templ_7745c5c3_Err
281		}
282		if r.WhenAt != "" {
283			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<time datetime=\"")
284			if templ_7745c5c3_Err != nil {
285				return templ_7745c5c3_Err
286			}
287			var templ_7745c5c3_Var14 string
288			templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.ResolveAttributeValue(r.WhenAt)
289			if templ_7745c5c3_Err != nil {
290				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 65, Col: 29}
291			}
292			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var14)
293			if templ_7745c5c3_Err != nil {
294				return templ_7745c5c3_Err
295			}
296			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\" title=\"")
297			if templ_7745c5c3_Err != nil {
298				return templ_7745c5c3_Err
299			}
300			var templ_7745c5c3_Var15 string
301			templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.ResolveAttributeValue(r.WhenAt)
302			if templ_7745c5c3_Err != nil {
303				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 65, Col: 48}
304			}
305			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15)
306			if templ_7745c5c3_Err != nil {
307				return templ_7745c5c3_Err
308			}
309			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "\">")
310			if templ_7745c5c3_Err != nil {
311				return templ_7745c5c3_Err
312			}
313			var templ_7745c5c3_Var16 string
314			templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(r.When)
315			if templ_7745c5c3_Err != nil {
316				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/tree.templ`, Line: 65, Col: 59}
317			}
318			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
319			if templ_7745c5c3_Err != nil {
320				return templ_7745c5c3_Err
321			}
322			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</time>")
323			if templ_7745c5c3_Err != nil {
324				return templ_7745c5c3_Err
325			}
326		}
327		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</td></tr>")
328		if templ_7745c5c3_Err != nil {
329			return templ_7745c5c3_Err
330		}
331		return nil
332	})
333}
334
335var _ = templruntime.GeneratedTemplate

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