v0.35.2 80d5067

commits_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// Commits is the history of a ref, or of a path at a ref: the commits of the
14// page grouped by day, and the way to the older ones.
15func Commits(l Layout, p CommitsPage) 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=\"commit-filter\" class=\"sr\">filter</label> <input id=\"commit-filter\" type=\"search\" data-filter=\".days tr\" data-groups=\".days section\" placeholder=\"Filter by subject, sha or author…\" autocomplete=\"off\" hx-on:input=\"ermite.filter(this)\"></div>")
49			if templ_7745c5c3_Err != nil {
50				return templ_7745c5c3_Err
51			}
52			if p.Path != "" {
53				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<p class=\"lede dim\">history of <code>")
54				if templ_7745c5c3_Err != nil {
55					return templ_7745c5c3_Err
56				}
57				var templ_7745c5c3_Var3 string
58				templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(p.Path)
59				if templ_7745c5c3_Err != nil {
60					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 22, Col: 48}
61				}
62				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
63				if templ_7745c5c3_Err != nil {
64					return templ_7745c5c3_Err
65				}
66				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</code> at ")
67				if templ_7745c5c3_Err != nil {
68					return templ_7745c5c3_Err
69				}
70				var templ_7745c5c3_Var4 string
71				templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(p.Ref)
72				if templ_7745c5c3_Err != nil {
73					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 22, Col: 68}
74				}
75				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
76				if templ_7745c5c3_Err != nil {
77					return templ_7745c5c3_Err
78				}
79				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</p>")
80				if templ_7745c5c3_Err != nil {
81					return templ_7745c5c3_Err
82				}
83			}
84			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " ")
85			if templ_7745c5c3_Err != nil {
86				return templ_7745c5c3_Err
87			}
88			if p.Live {
89				templ_7745c5c3_Err = LiveSlot("commits-head").Render(ctx, templ_7745c5c3_Buffer)
90				if templ_7745c5c3_Err != nil {
91					return templ_7745c5c3_Err
92				}
93			}
94			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, " <div class=\"days\">")
95			if templ_7745c5c3_Err != nil {
96				return templ_7745c5c3_Err
97			}
98			for _, g := range p.Days {
99				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<section aria-label=\"")
100				if templ_7745c5c3_Err != nil {
101					return templ_7745c5c3_Err
102				}
103				var templ_7745c5c3_Var5 string
104				templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.ResolveAttributeValue(g.Day)
105				if templ_7745c5c3_Err != nil {
106					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 29, Col: 31}
107				}
108				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
109				if templ_7745c5c3_Err != nil {
110					return templ_7745c5c3_Err
111				}
112				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\"><h2 class=\"rule-h\"><span>")
113				if templ_7745c5c3_Err != nil {
114					return templ_7745c5c3_Err
115				}
116				var templ_7745c5c3_Var6 string
117				templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(g.Day)
118				if templ_7745c5c3_Err != nil {
119					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 30, Col: 37}
120				}
121				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
122				if templ_7745c5c3_Err != nil {
123					return templ_7745c5c3_Err
124				}
125				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</span></h2>")
126				if templ_7745c5c3_Err != nil {
127					return templ_7745c5c3_Err
128				}
129				templ_7745c5c3_Err = CommitRows(g.Rows).Render(ctx, templ_7745c5c3_Buffer)
130				if templ_7745c5c3_Err != nil {
131					return templ_7745c5c3_Err
132				}
133				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</section>")
134				if templ_7745c5c3_Err != nil {
135					return templ_7745c5c3_Err
136				}
137			}
138			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</div>")
139			if templ_7745c5c3_Err != nil {
140				return templ_7745c5c3_Err
141			}
142			if len(p.Days) == 0 {
143				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<p class=\"lede dim\">no commits.</p>")
144				if templ_7745c5c3_Err != nil {
145					return templ_7745c5c3_Err
146				}
147			}
148			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, " ")
149			if templ_7745c5c3_Err != nil {
150				return templ_7745c5c3_Err
151			}
152			if p.Older != "" || p.Newest != "" {
153				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<nav class=\"pager\" aria-label=\"Pages\">")
154				if templ_7745c5c3_Err != nil {
155					return templ_7745c5c3_Err
156				}
157				if p.Newest != "" {
158					templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<a class=\"btn\" href=\"")
159					if templ_7745c5c3_Err != nil {
160						return templ_7745c5c3_Err
161					}
162					var templ_7745c5c3_Var7 templ.SafeURL
163					templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Newest))
164					if templ_7745c5c3_Err != nil {
165						return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 41, Col: 50}
166					}
167					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
168					if templ_7745c5c3_Err != nil {
169						return templ_7745c5c3_Err
170					}
171					templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\">← Newest</a> ")
172					if templ_7745c5c3_Err != nil {
173						return templ_7745c5c3_Err
174					}
175				} else {
176					templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<span class=\"btn\" aria-disabled=\"true\">← Newest</span> ")
177					if templ_7745c5c3_Err != nil {
178						return templ_7745c5c3_Err
179					}
180				}
181				if p.Older != "" {
182					templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<a class=\"btn\" href=\"")
183					if templ_7745c5c3_Err != nil {
184						return templ_7745c5c3_Err
185					}
186					var templ_7745c5c3_Var8 templ.SafeURL
187					templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Older))
188					if templ_7745c5c3_Err != nil {
189						return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 46, Col: 49}
190					}
191					_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
192					if templ_7745c5c3_Err != nil {
193						return templ_7745c5c3_Err
194					}
195					templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\" rel=\"next\">Older →</a>")
196					if templ_7745c5c3_Err != nil {
197						return templ_7745c5c3_Err
198					}
199				} else {
200					templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<span class=\"btn\" aria-disabled=\"true\">Older →</span>")
201					if templ_7745c5c3_Err != nil {
202						return templ_7745c5c3_Err
203					}
204				}
205				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</nav>")
206				if templ_7745c5c3_Err != nil {
207					return templ_7745c5c3_Err
208				}
209			}
210			return nil
211		})
212		templ_7745c5c3_Err = Shell(l, commitsRail(p)).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
213		if templ_7745c5c3_Err != nil {
214			return templ_7745c5c3_Err
215		}
216		return nil
217	})
218}
219
220func commitsRail(p CommitsPage) templ.Component {
221	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
222		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
223		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
224			return templ_7745c5c3_CtxErr
225		}
226		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
227		if !templ_7745c5c3_IsBuffer {
228			defer func() {
229				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
230				if templ_7745c5c3_Err == nil {
231					templ_7745c5c3_Err = templ_7745c5c3_BufErr
232				}
233			}()
234		}
235		ctx = templ.InitializeContext(ctx)
236		templ_7745c5c3_Var9 := templ.GetChildren(ctx)
237		if templ_7745c5c3_Var9 == nil {
238			templ_7745c5c3_Var9 = templ.NopComponent
239		}
240		ctx = templ.ClearChildren(ctx)
241		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<section aria-labelledby=\"r-hist\"><h2 id=\"r-hist\">History</h2><dl class=\"kv\"><dt>ref</dt><dd>")
242		if templ_7745c5c3_Err != nil {
243			return templ_7745c5c3_Err
244		}
245		var templ_7745c5c3_Var10 string
246		templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(p.Ref)
247		if templ_7745c5c3_Err != nil {
248			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 60, Col: 14}
249		}
250		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
251		if templ_7745c5c3_Err != nil {
252			return templ_7745c5c3_Err
253		}
254		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</dd><dt>on page</dt><dd>")
255		if templ_7745c5c3_Err != nil {
256			return templ_7745c5c3_Err
257		}
258		var templ_7745c5c3_Var11 string
259		templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.Count))
260		if templ_7745c5c3_Err != nil {
261			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 62, Col: 22}
262		}
263		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
264		if templ_7745c5c3_Err != nil {
265			return templ_7745c5c3_Err
266		}
267		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</dd>")
268		if templ_7745c5c3_Err != nil {
269			return templ_7745c5c3_Err
270		}
271		if p.Path != "" {
272			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<dt>path</dt><dd>")
273			if templ_7745c5c3_Err != nil {
274				return templ_7745c5c3_Err
275			}
276			var templ_7745c5c3_Var12 string
277			templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(p.Path)
278			if templ_7745c5c3_Err != nil {
279				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 65, Col: 16}
280			}
281			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
282			if templ_7745c5c3_Err != nil {
283				return templ_7745c5c3_Err
284			}
285			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</dd>")
286			if templ_7745c5c3_Err != nil {
287				return templ_7745c5c3_Err
288			}
289		}
290		if p.Open != nil {
291			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<dt>file</dt><dd><a href=\"")
292			if templ_7745c5c3_Err != nil {
293				return templ_7745c5c3_Err
294			}
295			var templ_7745c5c3_Var13 templ.SafeURL
296			templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Open.Href))
297			if templ_7745c5c3_Err != nil {
298				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 69, Col: 44}
299			}
300			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
301			if templ_7745c5c3_Err != nil {
302				return templ_7745c5c3_Err
303			}
304			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "\">")
305			if templ_7745c5c3_Err != nil {
306				return templ_7745c5c3_Err
307			}
308			var templ_7745c5c3_Var14 string
309			templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(p.Open.Label)
310			if templ_7745c5c3_Err != nil {
311				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 69, Col: 61}
312			}
313			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
314			if templ_7745c5c3_Err != nil {
315				return templ_7745c5c3_Err
316			}
317			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</a></dd>")
318			if templ_7745c5c3_Err != nil {
319				return templ_7745c5c3_Err
320			}
321		}
322		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</dl></section><section aria-labelledby=\"r-refs\"><h2 id=\"r-refs\">Refs on this page</h2>")
323		if templ_7745c5c3_Err != nil {
324			return templ_7745c5c3_Err
325		}
326		if len(p.Refs) > 0 {
327			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<nav class=\"outline\" aria-label=\"Refs on this page\">")
328			if templ_7745c5c3_Err != nil {
329				return templ_7745c5c3_Err
330			}
331			for _, r := range p.Refs {
332				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<a href=\"")
333				if templ_7745c5c3_Err != nil {
334					return templ_7745c5c3_Err
335				}
336				var templ_7745c5c3_Var15 templ.SafeURL
337				templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(r.Href))
338				if templ_7745c5c3_Err != nil {
339					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 78, Col: 36}
340				}
341				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
342				if templ_7745c5c3_Err != nil {
343					return templ_7745c5c3_Err
344				}
345				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\">")
346				if templ_7745c5c3_Err != nil {
347					return templ_7745c5c3_Err
348				}
349				var templ_7745c5c3_Var16 string
350				templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(r.Label)
351				if templ_7745c5c3_Err != nil {
352					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/commits.templ`, Line: 78, Col: 48}
353				}
354				_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
355				if templ_7745c5c3_Err != nil {
356					return templ_7745c5c3_Err
357				}
358				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</a>")
359				if templ_7745c5c3_Err != nil {
360					return templ_7745c5c3_Err
361				}
362			}
363			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "</nav>")
364			if templ_7745c5c3_Err != nil {
365				return templ_7745c5c3_Err
366			}
367		} else {
368			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<p class=\"dim\">no tag or branch head here</p>")
369			if templ_7745c5c3_Err != nil {
370				return templ_7745c5c3_Err
371			}
372		}
373		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "</section>")
374		if templ_7745c5c3_Err != nil {
375			return templ_7745c5c3_Err
376		}
377		return nil
378	})
379}
380
381var _ = 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 4

Tags 45

↑↓ moveenter openesc close