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
13import "strings"
14
15// MRList is the list of the merge requests of a repository: the open ones,
16// then the merged and closed ones.
17func MRList(l Layout, p MRListPage) templ.Component {
18 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
19 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
20 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
21 return templ_7745c5c3_CtxErr
22 }
23 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
24 if !templ_7745c5c3_IsBuffer {
25 defer func() {
26 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
27 if templ_7745c5c3_Err == nil {
28 templ_7745c5c3_Err = templ_7745c5c3_BufErr
29 }
30 }()
31 }
32 ctx = templ.InitializeContext(ctx)
33 templ_7745c5c3_Var1 := templ.GetChildren(ctx)
34 if templ_7745c5c3_Var1 == nil {
35 templ_7745c5c3_Var1 = templ.NopComponent
36 }
37 ctx = templ.ClearChildren(ctx)
38 templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
39 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
40 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
41 if !templ_7745c5c3_IsBuffer {
42 defer func() {
43 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
44 if templ_7745c5c3_Err == nil {
45 templ_7745c5c3_Err = templ_7745c5c3_BufErr
46 }
47 }()
48 }
49 ctx = templ.InitializeContext(ctx)
50 if p.Live {
51 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div id=\"mr-notice\"></div>")
52 if templ_7745c5c3_Err != nil {
53 return templ_7745c5c3_Err
54 }
55 }
56 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, " <div class=\"filter\"><label for=\"mr-filter\">filter></label> <input id=\"mr-filter\" type=\"search\" data-filter placeholder=\"title, branch, author or state ( / )\" autocomplete=\"off\" hx-on:input=\"let t = this.value.toLowerCase(); q('.mrs tbody tr').arr().forEach(r => r.hidden = !r.textContent.toLowerCase().includes(t));\n let first = q('.mrs tbody tr:not([hidden])').arr()[0]; first && q(first).take('data-cursor', '.mrs tbody tr')\"></div>")
57 if templ_7745c5c3_Err != nil {
58 return templ_7745c5c3_Err
59 }
60 if p.Newest == "" {
61 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<h2 class=\"rule-h\"><span>open</span><span>")
62 if templ_7745c5c3_Err != nil {
63 return templ_7745c5c3_Err
64 }
65 var templ_7745c5c3_Var3 string
66 templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(p.Open)))
67 if templ_7745c5c3_Err != nil {
68 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 27, Col: 64}
69 }
70 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
71 if templ_7745c5c3_Err != nil {
72 return templ_7745c5c3_Err
73 }
74 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</span></h2>")
75 if templ_7745c5c3_Err != nil {
76 return templ_7745c5c3_Err
77 }
78 templ_7745c5c3_Err = mrRows(p.Open, "Open merge requests").Render(ctx, templ_7745c5c3_Buffer)
79 if templ_7745c5c3_Err != nil {
80 return templ_7745c5c3_Err
81 }
82 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " ")
83 if templ_7745c5c3_Err != nil {
84 return templ_7745c5c3_Err
85 }
86 if len(p.Open) == 0 {
87 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<p class=\"lede dim\">no open merge requests.</p>")
88 if templ_7745c5c3_Err != nil {
89 return templ_7745c5c3_Err
90 }
91 }
92 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, " ")
93 if templ_7745c5c3_Err != nil {
94 return templ_7745c5c3_Err
95 }
96 if p.OpenNote != "" {
97 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<p class=\"note\">")
98 if templ_7745c5c3_Err != nil {
99 return templ_7745c5c3_Err
100 }
101 var templ_7745c5c3_Var4 string
102 templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(p.OpenNote)
103 if templ_7745c5c3_Err != nil {
104 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 33, Col: 32}
105 }
106 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
107 if templ_7745c5c3_Err != nil {
108 return templ_7745c5c3_Err
109 }
110 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</p>")
111 if templ_7745c5c3_Err != nil {
112 return templ_7745c5c3_Err
113 }
114 }
115 }
116 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, " <h2 class=\"rule-h\"><span>merged and closed</span><span>")
117 if templ_7745c5c3_Err != nil {
118 return templ_7745c5c3_Err
119 }
120 var templ_7745c5c3_Var5 string
121 templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(p.Done)))
122 if templ_7745c5c3_Err != nil {
123 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 36, Col: 76}
124 }
125 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
126 if templ_7745c5c3_Err != nil {
127 return templ_7745c5c3_Err
128 }
129 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</span></h2>")
130 if templ_7745c5c3_Err != nil {
131 return templ_7745c5c3_Err
132 }
133 templ_7745c5c3_Err = mrRows(p.Done, "Merged and closed merge requests").Render(ctx, templ_7745c5c3_Buffer)
134 if templ_7745c5c3_Err != nil {
135 return templ_7745c5c3_Err
136 }
137 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, " ")
138 if templ_7745c5c3_Err != nil {
139 return templ_7745c5c3_Err
140 }
141 if len(p.Done) == 0 {
142 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<p class=\"lede dim\">nothing merged or closed yet.</p>")
143 if templ_7745c5c3_Err != nil {
144 return templ_7745c5c3_Err
145 }
146 }
147 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, " ")
148 if templ_7745c5c3_Err != nil {
149 return templ_7745c5c3_Err
150 }
151 if p.Older != "" || p.Newest != "" {
152 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<nav class=\"pager\" aria-label=\"Pages\">")
153 if templ_7745c5c3_Err != nil {
154 return templ_7745c5c3_Err
155 }
156 if p.Newest != "" {
157 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "<a href=\"")
158 if templ_7745c5c3_Err != nil {
159 return templ_7745c5c3_Err
160 }
161 var templ_7745c5c3_Var6 templ.SafeURL
162 templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Newest))
163 if templ_7745c5c3_Err != nil {
164 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 44, Col: 38}
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, 17, "\">← newest</a> ")
171 if templ_7745c5c3_Err != nil {
172 return templ_7745c5c3_Err
173 }
174 } else {
175 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<span class=\"mute\">← newest</span> ")
176 if templ_7745c5c3_Err != nil {
177 return templ_7745c5c3_Err
178 }
179 }
180 if p.Older != "" {
181 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<a href=\"")
182 if templ_7745c5c3_Err != nil {
183 return templ_7745c5c3_Err
184 }
185 var templ_7745c5c3_Var7 templ.SafeURL
186 templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Older))
187 if templ_7745c5c3_Err != nil {
188 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 49, Col: 37}
189 }
190 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
191 if templ_7745c5c3_Err != nil {
192 return templ_7745c5c3_Err
193 }
194 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "\" rel=\"next\">older →</a>")
195 if templ_7745c5c3_Err != nil {
196 return templ_7745c5c3_Err
197 }
198 } else {
199 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<span class=\"mute\">older →</span>")
200 if templ_7745c5c3_Err != nil {
201 return templ_7745c5c3_Err
202 }
203 }
204 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</nav>")
205 if templ_7745c5c3_Err != nil {
206 return templ_7745c5c3_Err
207 }
208 }
209 return nil
210 })
211 templ_7745c5c3_Err = Shell(l, mrListRail(p)).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
212 if templ_7745c5c3_Err != nil {
213 return templ_7745c5c3_Err
214 }
215 return nil
216 })
217}
218
219func mrRows(rows []MRRow, label string) templ.Component {
220 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
221 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
222 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
223 return templ_7745c5c3_CtxErr
224 }
225 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
226 if !templ_7745c5c3_IsBuffer {
227 defer func() {
228 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
229 if templ_7745c5c3_Err == nil {
230 templ_7745c5c3_Err = templ_7745c5c3_BufErr
231 }
232 }()
233 }
234 ctx = templ.InitializeContext(ctx)
235 templ_7745c5c3_Var8 := templ.GetChildren(ctx)
236 if templ_7745c5c3_Var8 == nil {
237 templ_7745c5c3_Var8 = templ.NopComponent
238 }
239 ctx = templ.ClearChildren(ctx)
240 if len(rows) > 0 {
241 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<table class=\"list mrs\" aria-label=\"")
242 if templ_7745c5c3_Err != nil {
243 return templ_7745c5c3_Err
244 }
245 var templ_7745c5c3_Var9 string
246 templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.ResolveAttributeValue(label)
247 if templ_7745c5c3_Err != nil {
248 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 60, Col: 44}
249 }
250 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
251 if templ_7745c5c3_Err != nil {
252 return templ_7745c5c3_Err
253 }
254 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\"><tbody data-rows>")
255 if templ_7745c5c3_Err != nil {
256 return templ_7745c5c3_Err
257 }
258 for _, m := range rows {
259 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "<tr")
260 if templ_7745c5c3_Err != nil {
261 return templ_7745c5c3_Err
262 }
263 if m.Cursor {
264 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, " data-cursor")
265 if templ_7745c5c3_Err != nil {
266 return templ_7745c5c3_Err
267 }
268 }
269 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, " data-state=\"")
270 if templ_7745c5c3_Err != nil {
271 return templ_7745c5c3_Err
272 }
273 var templ_7745c5c3_Var10 string
274 templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.ResolveAttributeValue(m.State)
275 if templ_7745c5c3_Err != nil {
276 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 63, Col: 55}
277 }
278 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
279 if templ_7745c5c3_Err != nil {
280 return templ_7745c5c3_Err
281 }
282 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "\"><td class=\"cur\" aria-hidden=\"true\"></td><td class=\"c-n mute\">")
283 if templ_7745c5c3_Err != nil {
284 return templ_7745c5c3_Err
285 }
286 var templ_7745c5c3_Var11 string
287 templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(m.Number)
288 if templ_7745c5c3_Err != nil {
289 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 65, Col: 37}
290 }
291 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
292 if templ_7745c5c3_Err != nil {
293 return templ_7745c5c3_Err
294 }
295 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</td><td class=\"c-state\">")
296 if templ_7745c5c3_Err != nil {
297 return templ_7745c5c3_Err
298 }
299 var templ_7745c5c3_Var12 string
300 templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(m.State)
301 if templ_7745c5c3_Err != nil {
302 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 66, Col: 35}
303 }
304 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
305 if templ_7745c5c3_Err != nil {
306 return templ_7745c5c3_Err
307 }
308 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</td><td class=\"c-subject\"><a href=\"")
309 if templ_7745c5c3_Err != nil {
310 return templ_7745c5c3_Err
311 }
312 var templ_7745c5c3_Var13 templ.SafeURL
313 templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(m.Href))
314 if templ_7745c5c3_Err != nil {
315 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 67, Col: 59}
316 }
317 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
318 if templ_7745c5c3_Err != nil {
319 return templ_7745c5c3_Err
320 }
321 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "\">")
322 if templ_7745c5c3_Err != nil {
323 return templ_7745c5c3_Err
324 }
325 var templ_7745c5c3_Var14 string
326 templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(m.Title)
327 if templ_7745c5c3_Err != nil {
328 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 67, Col: 71}
329 }
330 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
331 if templ_7745c5c3_Err != nil {
332 return templ_7745c5c3_Err
333 }
334 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "</a> <span class=\"mute\">")
335 if templ_7745c5c3_Err != nil {
336 return templ_7745c5c3_Err
337 }
338 var templ_7745c5c3_Var15 string
339 templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(m.Branches)
340 if templ_7745c5c3_Err != nil {
341 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 67, Col: 109}
342 }
343 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
344 if templ_7745c5c3_Err != nil {
345 return templ_7745c5c3_Err
346 }
347 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</span></td><td class=\"c-who dim\">")
348 if templ_7745c5c3_Err != nil {
349 return templ_7745c5c3_Err
350 }
351 var templ_7745c5c3_Var16 string
352 templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(m.Author)
353 if templ_7745c5c3_Err != nil {
354 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 68, Col: 38}
355 }
356 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
357 if templ_7745c5c3_Err != nil {
358 return templ_7745c5c3_Err
359 }
360 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "</td><td class=\"c-when nowrap dim\">")
361 if templ_7745c5c3_Err != nil {
362 return templ_7745c5c3_Err
363 }
364 if m.WhenAt != "" {
365 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<time datetime=\"")
366 if templ_7745c5c3_Err != nil {
367 return templ_7745c5c3_Err
368 }
369 var templ_7745c5c3_Var17 string
370 templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.ResolveAttributeValue(m.WhenAt)
371 if templ_7745c5c3_Err != nil {
372 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 71, Col: 33}
373 }
374 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17)
375 if templ_7745c5c3_Err != nil {
376 return templ_7745c5c3_Err
377 }
378 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "\" title=\"")
379 if templ_7745c5c3_Err != nil {
380 return templ_7745c5c3_Err
381 }
382 var templ_7745c5c3_Var18 string
383 templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.ResolveAttributeValue(m.WhenAt)
384 if templ_7745c5c3_Err != nil {
385 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 71, Col: 52}
386 }
387 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18)
388 if templ_7745c5c3_Err != nil {
389 return templ_7745c5c3_Err
390 }
391 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "\">")
392 if templ_7745c5c3_Err != nil {
393 return templ_7745c5c3_Err
394 }
395 var templ_7745c5c3_Var19 string
396 templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(m.When)
397 if templ_7745c5c3_Err != nil {
398 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 71, Col: 63}
399 }
400 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
401 if templ_7745c5c3_Err != nil {
402 return templ_7745c5c3_Err
403 }
404 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</time>")
405 if templ_7745c5c3_Err != nil {
406 return templ_7745c5c3_Err
407 }
408 }
409 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</td></tr>")
410 if templ_7745c5c3_Err != nil {
411 return templ_7745c5c3_Err
412 }
413 }
414 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</tbody></table>")
415 if templ_7745c5c3_Err != nil {
416 return templ_7745c5c3_Err
417 }
418 }
419 return nil
420 })
421}
422
423func mrListRail(p MRListPage) templ.Component {
424 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
425 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
426 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
427 return templ_7745c5c3_CtxErr
428 }
429 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
430 if !templ_7745c5c3_IsBuffer {
431 defer func() {
432 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
433 if templ_7745c5c3_Err == nil {
434 templ_7745c5c3_Err = templ_7745c5c3_BufErr
435 }
436 }()
437 }
438 ctx = templ.InitializeContext(ctx)
439 templ_7745c5c3_Var20 := templ.GetChildren(ctx)
440 if templ_7745c5c3_Var20 == nil {
441 templ_7745c5c3_Var20 = templ.NopComponent
442 }
443 ctx = templ.ClearChildren(ctx)
444 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<section aria-labelledby=\"r-states\"><h2 id=\"r-states\">states</h2><dl class=\"kv\"><dt>open</dt><dd>awaits review</dd><dt>merged</dt><dd>the target took the branch</dd><dt>closed</dt><dd>refused, branch kept</dd></dl></section><section aria-labelledby=\"r-new\"><h2 id=\"r-new\">open one</h2>")
445 if templ_7745c5c3_Err != nil {
446 return templ_7745c5c3_Err
447 }
448 if len(p.Branches) > 0 {
449 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "<p class=\"dim\">compare a branch with ")
450 if templ_7745c5c3_Err != nil {
451 return templ_7745c5c3_Err
452 }
453 var templ_7745c5c3_Var21 string
454 templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(p.Default)
455 if templ_7745c5c3_Err != nil {
456 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 96, Col: 51}
457 }
458 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
459 if templ_7745c5c3_Err != nil {
460 return templ_7745c5c3_Err
461 }
462 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, ":</p><nav class=\"outline\" aria-label=\"Branches\">")
463 if templ_7745c5c3_Err != nil {
464 return templ_7745c5c3_Err
465 }
466 for _, b := range p.Branches {
467 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<a href=\"")
468 if templ_7745c5c3_Err != nil {
469 return templ_7745c5c3_Err
470 }
471 var templ_7745c5c3_Var22 templ.SafeURL
472 templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(b.Href))
473 if templ_7745c5c3_Err != nil {
474 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 99, Col: 36}
475 }
476 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
477 if templ_7745c5c3_Err != nil {
478 return templ_7745c5c3_Err
479 }
480 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "\">")
481 if templ_7745c5c3_Err != nil {
482 return templ_7745c5c3_Err
483 }
484 var templ_7745c5c3_Var23 string
485 templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(b.Name)
486 if templ_7745c5c3_Err != nil {
487 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 99, Col: 47}
488 }
489 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
490 if templ_7745c5c3_Err != nil {
491 return templ_7745c5c3_Err
492 }
493 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</a>")
494 if templ_7745c5c3_Err != nil {
495 return templ_7745c5c3_Err
496 }
497 }
498 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "</nav>")
499 if templ_7745c5c3_Err != nil {
500 return templ_7745c5c3_Err
501 }
502 } else {
503 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "<p class=\"dim\">there is no other branch to merge yet.</p>")
504 if templ_7745c5c3_Err != nil {
505 return templ_7745c5c3_Err
506 }
507 }
508 templ_7745c5c3_Err = CloneBlock(p.CLI).Render(ctx, templ_7745c5c3_Buffer)
509 if templ_7745c5c3_Err != nil {
510 return templ_7745c5c3_Err
511 }
512 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</section>")
513 if templ_7745c5c3_Err != nil {
514 return templ_7745c5c3_Err
515 }
516 return nil
517 })
518}
519
520// MergeRequest is a merge request: its facts, its description, the diff with
521// the notes under their lines, the general comments; and in the rail the merge
522// form, the checks, the settings, the commits and the files.
523func MergeRequest(l Layout, p MRPage) templ.Component {
524 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
525 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
526 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
527 return templ_7745c5c3_CtxErr
528 }
529 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
530 if !templ_7745c5c3_IsBuffer {
531 defer func() {
532 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
533 if templ_7745c5c3_Err == nil {
534 templ_7745c5c3_Err = templ_7745c5c3_BufErr
535 }
536 }()
537 }
538 ctx = templ.InitializeContext(ctx)
539 templ_7745c5c3_Var24 := templ.GetChildren(ctx)
540 if templ_7745c5c3_Var24 == nil {
541 templ_7745c5c3_Var24 = templ.NopComponent
542 }
543 ctx = templ.ClearChildren(ctx)
544 templ_7745c5c3_Var25 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
545 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
546 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
547 if !templ_7745c5c3_IsBuffer {
548 defer func() {
549 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
550 if templ_7745c5c3_Err == nil {
551 templ_7745c5c3_Err = templ_7745c5c3_BufErr
552 }
553 }()
554 }
555 ctx = templ.InitializeContext(ctx)
556 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<header class=\"show mr-h\"><h1><span class=\"mute\">")
557 if templ_7745c5c3_Err != nil {
558 return templ_7745c5c3_Err
559 }
560 var templ_7745c5c3_Var26 string
561 templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(p.Number)
562 if templ_7745c5c3_Err != nil {
563 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 115, Col: 36}
564 }
565 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
566 if templ_7745c5c3_Err != nil {
567 return templ_7745c5c3_Err
568 }
569 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "</span> ")
570 if templ_7745c5c3_Err != nil {
571 return templ_7745c5c3_Err
572 }
573 var templ_7745c5c3_Var27 string
574 templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(p.Title)
575 if templ_7745c5c3_Err != nil {
576 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 115, Col: 55}
577 }
578 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
579 if templ_7745c5c3_Err != nil {
580 return templ_7745c5c3_Err
581 }
582 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</h1><dl class=\"kv show-kv\"><dt>state</dt><dd class=\"mr-state\" data-state=\"")
583 if templ_7745c5c3_Err != nil {
584 return templ_7745c5c3_Err
585 }
586 var templ_7745c5c3_Var28 string
587 templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.State)
588 if templ_7745c5c3_Err != nil {
589 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 118, Col: 45}
590 }
591 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28)
592 if templ_7745c5c3_Err != nil {
593 return templ_7745c5c3_Err
594 }
595 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "\">")
596 if templ_7745c5c3_Err != nil {
597 return templ_7745c5c3_Err
598 }
599 var templ_7745c5c3_Var29 string
600 templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(p.State)
601 if templ_7745c5c3_Err != nil {
602 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 119, Col: 14}
603 }
604 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
605 if templ_7745c5c3_Err != nil {
606 return templ_7745c5c3_Err
607 }
608 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, " ")
609 if templ_7745c5c3_Err != nil {
610 return templ_7745c5c3_Err
611 }
612 if p.MergedShort != "" {
613 var templ_7745c5c3_Var30 string
614 templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(" · ")
615 if templ_7745c5c3_Err != nil {
616 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 121, Col: 14}
617 }
618 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
619 if templ_7745c5c3_Err != nil {
620 return templ_7745c5c3_Err
621 }
622 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "<a href=\"")
623 if templ_7745c5c3_Err != nil {
624 return templ_7745c5c3_Err
625 }
626 var templ_7745c5c3_Var31 templ.SafeURL
627 templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.MergedHref))
628 if templ_7745c5c3_Err != nil {
629 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 121, Col: 53}
630 }
631 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
632 if templ_7745c5c3_Err != nil {
633 return templ_7745c5c3_Err
634 }
635 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "\">")
636 if templ_7745c5c3_Err != nil {
637 return templ_7745c5c3_Err
638 }
639 var templ_7745c5c3_Var32 string
640 templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(p.MergedShort)
641 if templ_7745c5c3_Err != nil {
642 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 121, Col: 71}
643 }
644 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
645 if templ_7745c5c3_Err != nil {
646 return templ_7745c5c3_Err
647 }
648 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</a>")
649 if templ_7745c5c3_Err != nil {
650 return templ_7745c5c3_Err
651 }
652 var templ_7745c5c3_Var33 string
653 templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + p.MergeMode)
654 if templ_7745c5c3_Err != nil {
655 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 121, Col: 99}
656 }
657 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
658 if templ_7745c5c3_Err != nil {
659 return templ_7745c5c3_Err
660 }
661 }
662 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "</dd><dt>branch</dt><dd>")
663 if templ_7745c5c3_Err != nil {
664 return templ_7745c5c3_Err
665 }
666 templ_7745c5c3_Err = branchLink(p.Source, p.SourceHref).Render(ctx, templ_7745c5c3_Buffer)
667 if templ_7745c5c3_Err != nil {
668 return templ_7745c5c3_Err
669 }
670 var templ_7745c5c3_Var34 string
671 templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(" → ")
672 if templ_7745c5c3_Err != nil {
673 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 127, Col: 14}
674 }
675 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
676 if templ_7745c5c3_Err != nil {
677 return templ_7745c5c3_Err
678 }
679 templ_7745c5c3_Err = branchLink(p.Target, p.TargetHref).Render(ctx, templ_7745c5c3_Buffer)
680 if templ_7745c5c3_Err != nil {
681 return templ_7745c5c3_Err
682 }
683 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</dd><dt>opened</dt><dd>")
684 if templ_7745c5c3_Err != nil {
685 return templ_7745c5c3_Err
686 }
687 var templ_7745c5c3_Var35 string
688 templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(p.Opened.Name)
689 if templ_7745c5c3_Err != nil {
690 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 132, Col: 20}
691 }
692 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
693 if templ_7745c5c3_Err != nil {
694 return templ_7745c5c3_Err
695 }
696 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, " ")
697 if templ_7745c5c3_Err != nil {
698 return templ_7745c5c3_Err
699 }
700 if p.Opened.WhenAt != "" {
701 var templ_7745c5c3_Var36 string
702 templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(" · ")
703 if templ_7745c5c3_Err != nil {
704 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 134, Col: 14}
705 }
706 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
707 if templ_7745c5c3_Err != nil {
708 return templ_7745c5c3_Err
709 }
710 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, "<time datetime=\"")
711 if templ_7745c5c3_Err != nil {
712 return templ_7745c5c3_Err
713 }
714 var templ_7745c5c3_Var37 string
715 templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Opened.WhenAt)
716 if templ_7745c5c3_Err != nil {
717 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 134, Col: 48}
718 }
719 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37)
720 if templ_7745c5c3_Err != nil {
721 return templ_7745c5c3_Err
722 }
723 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "\" title=\"")
724 if templ_7745c5c3_Err != nil {
725 return templ_7745c5c3_Err
726 }
727 var templ_7745c5c3_Var38 string
728 templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Opened.Abs)
729 if templ_7745c5c3_Err != nil {
730 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 134, Col: 71}
731 }
732 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38)
733 if templ_7745c5c3_Err != nil {
734 return templ_7745c5c3_Err
735 }
736 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "\">")
737 if templ_7745c5c3_Err != nil {
738 return templ_7745c5c3_Err
739 }
740 var templ_7745c5c3_Var39 string
741 templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(p.Opened.When)
742 if templ_7745c5c3_Err != nil {
743 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 134, Col: 89}
744 }
745 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
746 if templ_7745c5c3_Err != nil {
747 return templ_7745c5c3_Err
748 }
749 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "</time>")
750 if templ_7745c5c3_Err != nil {
751 return templ_7745c5c3_Err
752 }
753 }
754 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</dd>")
755 if templ_7745c5c3_Err != nil {
756 return templ_7745c5c3_Err
757 }
758 if p.UpdatedAt != "" {
759 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "<dt>updated</dt><dd><time datetime=\"")
760 if templ_7745c5c3_Err != nil {
761 return templ_7745c5c3_Err
762 }
763 var templ_7745c5c3_Var40 string
764 templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.UpdatedAt)
765 if templ_7745c5c3_Err != nil {
766 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 139, Col: 37}
767 }
768 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var40)
769 if templ_7745c5c3_Err != nil {
770 return templ_7745c5c3_Err
771 }
772 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "\">")
773 if templ_7745c5c3_Err != nil {
774 return templ_7745c5c3_Err
775 }
776 var templ_7745c5c3_Var41 string
777 templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(p.Updated)
778 if templ_7745c5c3_Err != nil {
779 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 139, Col: 51}
780 }
781 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
782 if templ_7745c5c3_Err != nil {
783 return templ_7745c5c3_Err
784 }
785 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "</time></dd>")
786 if templ_7745c5c3_Err != nil {
787 return templ_7745c5c3_Err
788 }
789 }
790 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "</dl></header><div id=\"mr-notice\"></div>")
791 if templ_7745c5c3_Err != nil {
792 return templ_7745c5c3_Err
793 }
794 if len(p.Desc) > 0 {
795 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "<p class=\"mr-desc\">")
796 if templ_7745c5c3_Err != nil {
797 return templ_7745c5c3_Err
798 }
799 templ_7745c5c3_Err = userText(p.Desc).Render(ctx, templ_7745c5c3_Buffer)
800 if templ_7745c5c3_Err != nil {
801 return templ_7745c5c3_Err
802 }
803 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "</p>")
804 if templ_7745c5c3_Err != nil {
805 return templ_7745c5c3_Err
806 }
807 }
808 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 72, " ")
809 if templ_7745c5c3_Err != nil {
810 return templ_7745c5c3_Err
811 }
812 if p.Since != nil {
813 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 73, "<nav class=\"since\" aria-label=\"Diff range\"><a href=\"")
814 if templ_7745c5c3_Err != nil {
815 return templ_7745c5c3_Err
816 }
817 var templ_7745c5c3_Var42 templ.SafeURL
818 templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Since.AllHref))
819 if templ_7745c5c3_Err != nil {
820 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 150, Col: 42}
821 }
822 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
823 if templ_7745c5c3_Err != nil {
824 return templ_7745c5c3_Err
825 }
826 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 74, "\"")
827 if templ_7745c5c3_Err != nil {
828 return templ_7745c5c3_Err
829 }
830 if !p.Since.Current {
831 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 75, " aria-current=\"page\"")
832 if templ_7745c5c3_Err != nil {
833 return templ_7745c5c3_Err
834 }
835 }
836 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 76, ">all changes <span class=\"mute\">vs ")
837 if templ_7745c5c3_Err != nil {
838 return templ_7745c5c3_Err
839 }
840 var templ_7745c5c3_Var43 string
841 templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(p.Target)
842 if templ_7745c5c3_Err != nil {
843 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 154, Col: 49}
844 }
845 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
846 if templ_7745c5c3_Err != nil {
847 return templ_7745c5c3_Err
848 }
849 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 77, "</span></a> <a href=\"")
850 if templ_7745c5c3_Err != nil {
851 return templ_7745c5c3_Err
852 }
853 var templ_7745c5c3_Var44 templ.SafeURL
854 templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Since.SinceHref))
855 if templ_7745c5c3_Err != nil {
856 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 156, Col: 44}
857 }
858 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
859 if templ_7745c5c3_Err != nil {
860 return templ_7745c5c3_Err
861 }
862 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 78, "\"")
863 if templ_7745c5c3_Err != nil {
864 return templ_7745c5c3_Err
865 }
866 if p.Since.Current {
867 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 79, " aria-current=\"page\"")
868 if templ_7745c5c3_Err != nil {
869 return templ_7745c5c3_Err
870 }
871 }
872 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 80, ">since your last read <span class=\"mute\">")
873 if templ_7745c5c3_Err != nil {
874 return templ_7745c5c3_Err
875 }
876 var templ_7745c5c3_Var45 string
877 templ_7745c5c3_Var45, templ_7745c5c3_Err = templ.JoinStringErrs(p.Since.ReadShort)
878 if templ_7745c5c3_Err != nil {
879 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 160, Col: 64}
880 }
881 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var45))
882 if templ_7745c5c3_Err != nil {
883 return templ_7745c5c3_Err
884 }
885 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 81, " → ")
886 if templ_7745c5c3_Err != nil {
887 return templ_7745c5c3_Err
888 }
889 var templ_7745c5c3_Var46 string
890 templ_7745c5c3_Var46, templ_7745c5c3_Err = templ.JoinStringErrs(p.Since.HeadShort)
891 if templ_7745c5c3_Err != nil {
892 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 160, Col: 90}
893 }
894 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
895 if templ_7745c5c3_Err != nil {
896 return templ_7745c5c3_Err
897 }
898 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 82, "</span></a></nav>")
899 if templ_7745c5c3_Err != nil {
900 return templ_7745c5c3_Err
901 }
902 }
903 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 83, " ")
904 if templ_7745c5c3_Err != nil {
905 return templ_7745c5c3_Err
906 }
907 if p.SinceNote != "" {
908 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 84, "<p class=\"notice\">")
909 if templ_7745c5c3_Err != nil {
910 return templ_7745c5c3_Err
911 }
912 var templ_7745c5c3_Var47 string
913 templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(p.SinceNote)
914 if templ_7745c5c3_Err != nil {
915 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 164, Col: 34}
916 }
917 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
918 if templ_7745c5c3_Err != nil {
919 return templ_7745c5c3_Err
920 }
921 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "</p>")
922 if templ_7745c5c3_Err != nil {
923 return templ_7745c5c3_Err
924 }
925 }
926 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, " <div class=\"diff-tools\" role=\"toolbar\" aria-label=\"Diff view\"><span class=\"dim\">")
927 if templ_7745c5c3_Err != nil {
928 return templ_7745c5c3_Err
929 }
930 var templ_7745c5c3_Var48 string
931 templ_7745c5c3_Var48, templ_7745c5c3_Err = templ.JoinStringErrs(plural(p.NFiles, "file", "files"))
932 if templ_7745c5c3_Err != nil {
933 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 167, Col: 56}
934 }
935 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var48))
936 if templ_7745c5c3_Err != nil {
937 return templ_7745c5c3_Err
938 }
939 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, " · <span class=\"plus\">+")
940 if templ_7745c5c3_Err != nil {
941 return templ_7745c5c3_Err
942 }
943 var templ_7745c5c3_Var49 string
944 templ_7745c5c3_Var49, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.Adds))
945 if templ_7745c5c3_Err != nil {
946 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 167, Col: 96}
947 }
948 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var49))
949 if templ_7745c5c3_Err != nil {
950 return templ_7745c5c3_Err
951 }
952 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "</span> <span class=\"minus\">-")
953 if templ_7745c5c3_Err != nil {
954 return templ_7745c5c3_Err
955 }
956 var templ_7745c5c3_Var50 string
957 templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.Dels))
958 if templ_7745c5c3_Err != nil {
959 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 167, Col: 141}
960 }
961 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
962 if templ_7745c5c3_Err != nil {
963 return templ_7745c5c3_Err
964 }
965 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "</span></span> <span class=\"grow\"></span>")
966 if templ_7745c5c3_Err != nil {
967 return templ_7745c5c3_Err
968 }
969 templ_7745c5c3_Err = viewLink(p.DiffView, "unified", "[u]nified", "u", p.UnifiedHref).Render(ctx, templ_7745c5c3_Buffer)
970 if templ_7745c5c3_Err != nil {
971 return templ_7745c5c3_Err
972 }
973 templ_7745c5c3_Err = viewLink(p.DiffView, "split", "[d] split", "d", p.SplitHref).Render(ctx, templ_7745c5c3_Buffer)
974 if templ_7745c5c3_Err != nil {
975 return templ_7745c5c3_Err
976 }
977 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "<button type=\"button\" aria-keyshortcuts=\"x\" hx-on:click=\"document.body.dispatchEvent(new CustomEvent('k-collapse'))\">[x] collapse all</button></div>")
978 if templ_7745c5c3_Err != nil {
979 return templ_7745c5c3_Err
980 }
981 if p.Invisible {
982 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "<p class=\"notice\">this diff holds invisible characters (direction controls, zero-width characters). They are shown as <span class=\"inv\"><U+XXXX></span> markers, never applied.</p>")
983 if templ_7745c5c3_Err != nil {
984 return templ_7745c5c3_Err
985 }
986 }
987 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, " ")
988 if templ_7745c5c3_Err != nil {
989 return templ_7745c5c3_Err
990 }
991 if p.Note != "" {
992 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "<p class=\"notice\">")
993 if templ_7745c5c3_Err != nil {
994 return templ_7745c5c3_Err
995 }
996 var templ_7745c5c3_Var51 string
997 templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(p.Note)
998 if templ_7745c5c3_Err != nil {
999 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 180, Col: 29}
1000 }
1001 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51))
1002 if templ_7745c5c3_Err != nil {
1003 return templ_7745c5c3_Err
1004 }
1005 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "</p>")
1006 if templ_7745c5c3_Err != nil {
1007 return templ_7745c5c3_Err
1008 }
1009 }
1010 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, " <div id=\"diffs\"")
1011 if templ_7745c5c3_Err != nil {
1012 return templ_7745c5c3_Err
1013 }
1014 if p.Both {
1015 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, " data-diff=\"")
1016 if templ_7745c5c3_Err != nil {
1017 return templ_7745c5c3_Err
1018 }
1019 var templ_7745c5c3_Var52 string
1020 templ_7745c5c3_Var52, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.View)
1021 if templ_7745c5c3_Err != nil {
1022 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 185, Col: 22}
1023 }
1024 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var52)
1025 if templ_7745c5c3_Err != nil {
1026 return templ_7745c5c3_Err
1027 }
1028 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "\"")
1029 if templ_7745c5c3_Err != nil {
1030 return templ_7745c5c3_Err
1031 }
1032 } else {
1033 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, " data-view=\"")
1034 if templ_7745c5c3_Err != nil {
1035 return templ_7745c5c3_Err
1036 }
1037 var templ_7745c5c3_Var53 string
1038 templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.View)
1039 if templ_7745c5c3_Err != nil {
1040 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 187, Col: 22}
1041 }
1042 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var53)
1043 if templ_7745c5c3_Err != nil {
1044 return templ_7745c5c3_Err
1045 }
1046 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "\"")
1047 if templ_7745c5c3_Err != nil {
1048 return templ_7745c5c3_Err
1049 }
1050 }
1051 if p.Both && !p.Pinned {
1052 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, " hx-live=\"this.dataset.diff = sessionStorage.getItem('diff') || this.dataset.diff\"")
1053 if templ_7745c5c3_Err != nil {
1054 return templ_7745c5c3_Err
1055 }
1056 }
1057 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, ">")
1058 if templ_7745c5c3_Err != nil {
1059 return templ_7745c5c3_Err
1060 }
1061 for _, f := range p.Files {
1062 templ_7745c5c3_Err = DiffFileView(f, p.DiffView).Render(ctx, templ_7745c5c3_Buffer)
1063 if templ_7745c5c3_Err != nil {
1064 return templ_7745c5c3_Err
1065 }
1066 }
1067 if len(p.Files) == 0 {
1068 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "<p class=\"note\">no changed files.</p>")
1069 if templ_7745c5c3_Err != nil {
1070 return templ_7745c5c3_Err
1071 }
1072 }
1073 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "</div><h2 class=\"rule-h\" id=\"comments\"><span>comments</span><span>")
1074 if templ_7745c5c3_Err != nil {
1075 return templ_7745c5c3_Err
1076 }
1077 var templ_7745c5c3_Var54 string
1078 templ_7745c5c3_Var54, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.NUnresolved))
1079 if templ_7745c5c3_Err != nil {
1080 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 200, Col: 83}
1081 }
1082 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var54))
1083 if templ_7745c5c3_Err != nil {
1084 return templ_7745c5c3_Err
1085 }
1086 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, " open / ")
1087 if templ_7745c5c3_Err != nil {
1088 return templ_7745c5c3_Err
1089 }
1090 var templ_7745c5c3_Var55 string
1091 templ_7745c5c3_Var55, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.NComments))
1092 if templ_7745c5c3_Err != nil {
1093 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 200, Col: 112}
1094 }
1095 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var55))
1096 if templ_7745c5c3_Err != nil {
1097 return templ_7745c5c3_Err
1098 }
1099 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 105, "</span></h2>")
1100 if templ_7745c5c3_Err != nil {
1101 return templ_7745c5c3_Err
1102 }
1103 for _, c := range p.Loose {
1104 templ_7745c5c3_Err = commentView(c, "").Render(ctx, templ_7745c5c3_Buffer)
1105 if templ_7745c5c3_Err != nil {
1106 return templ_7745c5c3_Err
1107 }
1108 }
1109 for _, c := range p.General {
1110 templ_7745c5c3_Err = commentView(c, "").Render(ctx, templ_7745c5c3_Buffer)
1111 if templ_7745c5c3_Err != nil {
1112 return templ_7745c5c3_Err
1113 }
1114 }
1115 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 106, " ")
1116 if templ_7745c5c3_Err != nil {
1117 return templ_7745c5c3_Err
1118 }
1119 if p.NComments == 0 {
1120 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 107, "<p class=\"dim\">no comments yet.</p>")
1121 if templ_7745c5c3_Err != nil {
1122 return templ_7745c5c3_Err
1123 }
1124 }
1125 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 108, " ")
1126 if templ_7745c5c3_Err != nil {
1127 return templ_7745c5c3_Err
1128 }
1129 if p.GeneralForm != nil {
1130 templ_7745c5c3_Err = commentForm(*p.GeneralForm, "").Render(ctx, templ_7745c5c3_Buffer)
1131 if templ_7745c5c3_Err != nil {
1132 return templ_7745c5c3_Err
1133 }
1134 }
1135 return nil
1136 })
1137 templ_7745c5c3_Err = Shell(l, mrRail(p)).Render(templ.WithChildren(ctx, templ_7745c5c3_Var25), templ_7745c5c3_Buffer)
1138 if templ_7745c5c3_Err != nil {
1139 return templ_7745c5c3_Err
1140 }
1141 return nil
1142 })
1143}
1144
1145func branchLink(name, href string) templ.Component {
1146 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1147 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1148 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1149 return templ_7745c5c3_CtxErr
1150 }
1151 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1152 if !templ_7745c5c3_IsBuffer {
1153 defer func() {
1154 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1155 if templ_7745c5c3_Err == nil {
1156 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1157 }
1158 }()
1159 }
1160 ctx = templ.InitializeContext(ctx)
1161 templ_7745c5c3_Var56 := templ.GetChildren(ctx)
1162 if templ_7745c5c3_Var56 == nil {
1163 templ_7745c5c3_Var56 = templ.NopComponent
1164 }
1165 ctx = templ.ClearChildren(ctx)
1166 if href != "" {
1167 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 109, "<a href=\"")
1168 if templ_7745c5c3_Err != nil {
1169 return templ_7745c5c3_Err
1170 }
1171 var templ_7745c5c3_Var57 templ.SafeURL
1172 templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(href))
1173 if templ_7745c5c3_Err != nil {
1174 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 218, Col: 31}
1175 }
1176 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
1177 if templ_7745c5c3_Err != nil {
1178 return templ_7745c5c3_Err
1179 }
1180 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 110, "\">")
1181 if templ_7745c5c3_Err != nil {
1182 return templ_7745c5c3_Err
1183 }
1184 var templ_7745c5c3_Var58 string
1185 templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(name)
1186 if templ_7745c5c3_Err != nil {
1187 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 218, Col: 40}
1188 }
1189 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
1190 if templ_7745c5c3_Err != nil {
1191 return templ_7745c5c3_Err
1192 }
1193 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 111, "</a>")
1194 if templ_7745c5c3_Err != nil {
1195 return templ_7745c5c3_Err
1196 }
1197 } else {
1198 var templ_7745c5c3_Var59 string
1199 templ_7745c5c3_Var59, templ_7745c5c3_Err = templ.JoinStringErrs(name)
1200 if templ_7745c5c3_Err != nil {
1201 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 220, Col: 8}
1202 }
1203 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var59))
1204 if templ_7745c5c3_Err != nil {
1205 return templ_7745c5c3_Err
1206 }
1207 }
1208 return nil
1209 })
1210}
1211
1212// lineNotes are the comments under a line of the diff, and the form to write
1213// one when the reader asked for it. The diff is in the page twice (unified and
1214// split); the suffix keeps the ids unique, the unified table having none.
1215func lineNotes(notes []CommentView, form *CommentForm, suffix string) templ.Component {
1216 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1217 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1218 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1219 return templ_7745c5c3_CtxErr
1220 }
1221 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1222 if !templ_7745c5c3_IsBuffer {
1223 defer func() {
1224 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1225 if templ_7745c5c3_Err == nil {
1226 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1227 }
1228 }()
1229 }
1230 ctx = templ.InitializeContext(ctx)
1231 templ_7745c5c3_Var60 := templ.GetChildren(ctx)
1232 if templ_7745c5c3_Var60 == nil {
1233 templ_7745c5c3_Var60 = templ.NopComponent
1234 }
1235 ctx = templ.ClearChildren(ctx)
1236 for _, c := range notes {
1237 templ_7745c5c3_Err = commentView(c, suffix).Render(ctx, templ_7745c5c3_Buffer)
1238 if templ_7745c5c3_Err != nil {
1239 return templ_7745c5c3_Err
1240 }
1241 }
1242 if form != nil {
1243 templ_7745c5c3_Err = commentForm(*form, suffix).Render(ctx, templ_7745c5c3_Buffer)
1244 if templ_7745c5c3_Err != nil {
1245 return templ_7745c5c3_Err
1246 }
1247 }
1248 return nil
1249 })
1250}
1251
1252// commentView is a note: a ruled block, under its line in the diff or in the
1253// list of comments. The text is plain: escaped, its line breaks kept, its
1254// http(s) addresses linked.
1255func commentView(c CommentView, suffix string) templ.Component {
1256 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1257 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1258 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1259 return templ_7745c5c3_CtxErr
1260 }
1261 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1262 if !templ_7745c5c3_IsBuffer {
1263 defer func() {
1264 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1265 if templ_7745c5c3_Err == nil {
1266 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1267 }
1268 }()
1269 }
1270 ctx = templ.InitializeContext(ctx)
1271 templ_7745c5c3_Var61 := templ.GetChildren(ctx)
1272 if templ_7745c5c3_Var61 == nil {
1273 templ_7745c5c3_Var61 = templ.NopComponent
1274 }
1275 ctx = templ.ClearChildren(ctx)
1276 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 112, "<div class=\"cmt\" id=\"")
1277 if templ_7745c5c3_Err != nil {
1278 return templ_7745c5c3_Err
1279 }
1280 var templ_7745c5c3_Var62 string
1281 templ_7745c5c3_Var62, templ_7745c5c3_Err = templ.ResolveAttributeValue("c" + c.ID + suffix)
1282 if templ_7745c5c3_Err != nil {
1283 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 240, Col: 42}
1284 }
1285 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var62)
1286 if templ_7745c5c3_Err != nil {
1287 return templ_7745c5c3_Err
1288 }
1289 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 113, "\" data-resolved=\"")
1290 if templ_7745c5c3_Err != nil {
1291 return templ_7745c5c3_Err
1292 }
1293 var templ_7745c5c3_Var63 string
1294 templ_7745c5c3_Var63, templ_7745c5c3_Err = templ.ResolveAttributeValue(boolText(c.Resolved))
1295 if templ_7745c5c3_Err != nil {
1296 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 240, Col: 81}
1297 }
1298 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var63)
1299 if templ_7745c5c3_Err != nil {
1300 return templ_7745c5c3_Err
1301 }
1302 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 114, "\"><p class=\"c-head\"><span class=\"c-who\">")
1303 if templ_7745c5c3_Err != nil {
1304 return templ_7745c5c3_Err
1305 }
1306 var templ_7745c5c3_Var64 string
1307 templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(c.Author)
1308 if templ_7745c5c3_Err != nil {
1309 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 242, Col: 33}
1310 }
1311 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
1312 if templ_7745c5c3_Err != nil {
1313 return templ_7745c5c3_Err
1314 }
1315 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 115, "</span> ")
1316 if templ_7745c5c3_Err != nil {
1317 return templ_7745c5c3_Err
1318 }
1319 if c.WhenAt != "" {
1320 var templ_7745c5c3_Var65 string
1321 templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
1322 if templ_7745c5c3_Err != nil {
1323 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 244, Col: 9}
1324 }
1325 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
1326 if templ_7745c5c3_Err != nil {
1327 return templ_7745c5c3_Err
1328 }
1329 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 116, "<time class=\"mute\" datetime=\"")
1330 if templ_7745c5c3_Err != nil {
1331 return templ_7745c5c3_Err
1332 }
1333 var templ_7745c5c3_Var66 string
1334 templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.ResolveAttributeValue(c.WhenAt)
1335 if templ_7745c5c3_Err != nil {
1336 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 244, Col: 49}
1337 }
1338 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var66)
1339 if templ_7745c5c3_Err != nil {
1340 return templ_7745c5c3_Err
1341 }
1342 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 117, "\" title=\"")
1343 if templ_7745c5c3_Err != nil {
1344 return templ_7745c5c3_Err
1345 }
1346 var templ_7745c5c3_Var67 string
1347 templ_7745c5c3_Var67, templ_7745c5c3_Err = templ.ResolveAttributeValue(c.Abs)
1348 if templ_7745c5c3_Err != nil {
1349 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 244, Col: 65}
1350 }
1351 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var67)
1352 if templ_7745c5c3_Err != nil {
1353 return templ_7745c5c3_Err
1354 }
1355 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 118, "\">")
1356 if templ_7745c5c3_Err != nil {
1357 return templ_7745c5c3_Err
1358 }
1359 var templ_7745c5c3_Var68 string
1360 templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(c.When)
1361 if templ_7745c5c3_Err != nil {
1362 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 244, Col: 76}
1363 }
1364 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
1365 if templ_7745c5c3_Err != nil {
1366 return templ_7745c5c3_Err
1367 }
1368 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 119, "</time> ")
1369 if templ_7745c5c3_Err != nil {
1370 return templ_7745c5c3_Err
1371 }
1372 }
1373 if c.Resolved {
1374 var templ_7745c5c3_Var69 string
1375 templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
1376 if templ_7745c5c3_Err != nil {
1377 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 247, Col: 9}
1378 }
1379 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
1380 if templ_7745c5c3_Err != nil {
1381 return templ_7745c5c3_Err
1382 }
1383 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 120, "<span class=\"c-state\">resolved</span> ")
1384 if templ_7745c5c3_Err != nil {
1385 return templ_7745c5c3_Err
1386 }
1387 }
1388 if c.Outdated {
1389 var templ_7745c5c3_Var70 string
1390 templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
1391 if templ_7745c5c3_Err != nil {
1392 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 250, Col: 9}
1393 }
1394 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
1395 if templ_7745c5c3_Err != nil {
1396 return templ_7745c5c3_Err
1397 }
1398 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 121, "<span class=\"c-state\" title=\"written on an earlier head; the line may have moved\">outdated</span> ")
1399 if templ_7745c5c3_Err != nil {
1400 return templ_7745c5c3_Err
1401 }
1402 }
1403 if c.Where != "" {
1404 var templ_7745c5c3_Var71 string
1405 templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(" ")
1406 if templ_7745c5c3_Err != nil {
1407 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 253, Col: 9}
1408 }
1409 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71))
1410 if templ_7745c5c3_Err != nil {
1411 return templ_7745c5c3_Err
1412 }
1413 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 122, "<span class=\"c-where mute\">")
1414 if templ_7745c5c3_Err != nil {
1415 return templ_7745c5c3_Err
1416 }
1417 var templ_7745c5c3_Var72 string
1418 templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(c.Where)
1419 if templ_7745c5c3_Err != nil {
1420 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 253, Col: 47}
1421 }
1422 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
1423 if templ_7745c5c3_Err != nil {
1424 return templ_7745c5c3_Err
1425 }
1426 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 123, "</span>")
1427 if templ_7745c5c3_Err != nil {
1428 return templ_7745c5c3_Err
1429 }
1430 }
1431 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 124, "</p><p class=\"c-text\">")
1432 if templ_7745c5c3_Err != nil {
1433 return templ_7745c5c3_Err
1434 }
1435 templ_7745c5c3_Err = userText(c.Parts).Render(ctx, templ_7745c5c3_Buffer)
1436 if templ_7745c5c3_Err != nil {
1437 return templ_7745c5c3_Err
1438 }
1439 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 125, "</p>")
1440 if templ_7745c5c3_Err != nil {
1441 return templ_7745c5c3_Err
1442 }
1443 if c.Resolve != nil {
1444 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 126, "<form class=\"c-act\" method=\"post\" action=\"")
1445 if templ_7745c5c3_Err != nil {
1446 return templ_7745c5c3_Err
1447 }
1448 var templ_7745c5c3_Var73 templ.SafeURL
1449 templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(c.Resolve.Action))
1450 if templ_7745c5c3_Err != nil {
1451 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 258, Col: 77}
1452 }
1453 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
1454 if templ_7745c5c3_Err != nil {
1455 return templ_7745c5c3_Err
1456 }
1457 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 127, "\"><input type=\"hidden\" name=\"resolved\" value=\"")
1458 if templ_7745c5c3_Err != nil {
1459 return templ_7745c5c3_Err
1460 }
1461 var templ_7745c5c3_Var74 string
1462 templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.ResolveAttributeValue(boolText(c.Resolve.Value))
1463 if templ_7745c5c3_Err != nil {
1464 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 259, Col: 74}
1465 }
1466 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var74)
1467 if templ_7745c5c3_Err != nil {
1468 return templ_7745c5c3_Err
1469 }
1470 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 128, "\"> <button type=\"submit\">")
1471 if templ_7745c5c3_Err != nil {
1472 return templ_7745c5c3_Err
1473 }
1474 var templ_7745c5c3_Var75 string
1475 templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(c.Resolve.Label)
1476 if templ_7745c5c3_Err != nil {
1477 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 260, Col: 43}
1478 }
1479 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75))
1480 if templ_7745c5c3_Err != nil {
1481 return templ_7745c5c3_Err
1482 }
1483 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 129, "</button></form>")
1484 if templ_7745c5c3_Err != nil {
1485 return templ_7745c5c3_Err
1486 }
1487 }
1488 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 130, "</div>")
1489 if templ_7745c5c3_Err != nil {
1490 return templ_7745c5c3_Err
1491 }
1492 return nil
1493 })
1494}
1495
1496func boolText(b bool) string {
1497 if b {
1498 return "true"
1499 }
1500 return "false"
1501}
1502
1503// commentForm writes a comment, general or on a line.
1504func commentForm(f CommentForm, suffix string) templ.Component {
1505 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1506 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1507 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1508 return templ_7745c5c3_CtxErr
1509 }
1510 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1511 if !templ_7745c5c3_IsBuffer {
1512 defer func() {
1513 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1514 if templ_7745c5c3_Err == nil {
1515 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1516 }
1517 }()
1518 }
1519 ctx = templ.InitializeContext(ctx)
1520 templ_7745c5c3_Var76 := templ.GetChildren(ctx)
1521 if templ_7745c5c3_Var76 == nil {
1522 templ_7745c5c3_Var76 = templ.NopComponent
1523 }
1524 ctx = templ.ClearChildren(ctx)
1525 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 131, "<form class=\"cform\" method=\"post\" action=\"")
1526 if templ_7745c5c3_Err != nil {
1527 return templ_7745c5c3_Err
1528 }
1529 var templ_7745c5c3_Var77 templ.SafeURL
1530 templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(f.Action))
1531 if templ_7745c5c3_Err != nil {
1532 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 275, Col: 67}
1533 }
1534 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
1535 if templ_7745c5c3_Err != nil {
1536 return templ_7745c5c3_Err
1537 }
1538 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 132, "\"><label for=\"")
1539 if templ_7745c5c3_Err != nil {
1540 return templ_7745c5c3_Err
1541 }
1542 var templ_7745c5c3_Var78 string
1543 templ_7745c5c3_Var78, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.ID + suffix)
1544 if templ_7745c5c3_Err != nil {
1545 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 276, Col: 28}
1546 }
1547 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var78)
1548 if templ_7745c5c3_Err != nil {
1549 return templ_7745c5c3_Err
1550 }
1551 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 133, "\">")
1552 if templ_7745c5c3_Err != nil {
1553 return templ_7745c5c3_Err
1554 }
1555 var templ_7745c5c3_Var79 string
1556 templ_7745c5c3_Var79, templ_7745c5c3_Err = templ.JoinStringErrs(f.Title)
1557 if templ_7745c5c3_Err != nil {
1558 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 276, Col: 40}
1559 }
1560 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var79))
1561 if templ_7745c5c3_Err != nil {
1562 return templ_7745c5c3_Err
1563 }
1564 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 134, "</label> <textarea id=\"")
1565 if templ_7745c5c3_Err != nil {
1566 return templ_7745c5c3_Err
1567 }
1568 var templ_7745c5c3_Var80 string
1569 templ_7745c5c3_Var80, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.ID + suffix)
1570 if templ_7745c5c3_Err != nil {
1571 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 278, Col: 21}
1572 }
1573 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var80)
1574 if templ_7745c5c3_Err != nil {
1575 return templ_7745c5c3_Err
1576 }
1577 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 135, "\" name=\"text\" rows=\"3\" maxlength=\"8000\" required placeholder=\"plain text, 8000 characters at most\"")
1578 if templ_7745c5c3_Err != nil {
1579 return templ_7745c5c3_Err
1580 }
1581 if f.Focus {
1582 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 136, " autofocus")
1583 if templ_7745c5c3_Err != nil {
1584 return templ_7745c5c3_Err
1585 }
1586 }
1587 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 137, "></textarea> ")
1588 if templ_7745c5c3_Err != nil {
1589 return templ_7745c5c3_Err
1590 }
1591 if f.Path != "" {
1592 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 138, "<input type=\"hidden\" name=\"path\" value=\"")
1593 if templ_7745c5c3_Err != nil {
1594 return templ_7745c5c3_Err
1595 }
1596 var templ_7745c5c3_Var81 string
1597 templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.Path)
1598 if templ_7745c5c3_Err != nil {
1599 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 289, Col: 50}
1600 }
1601 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var81)
1602 if templ_7745c5c3_Err != nil {
1603 return templ_7745c5c3_Err
1604 }
1605 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 139, "\"> <input type=\"hidden\" name=\"line\" value=\"")
1606 if templ_7745c5c3_Err != nil {
1607 return templ_7745c5c3_Err
1608 }
1609 var templ_7745c5c3_Var82 string
1610 templ_7745c5c3_Var82, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.Line)
1611 if templ_7745c5c3_Err != nil {
1612 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 290, Col: 50}
1613 }
1614 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var82)
1615 if templ_7745c5c3_Err != nil {
1616 return templ_7745c5c3_Err
1617 }
1618 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 140, "\"> <input type=\"hidden\" name=\"side\" value=\"")
1619 if templ_7745c5c3_Err != nil {
1620 return templ_7745c5c3_Err
1621 }
1622 var templ_7745c5c3_Var83 string
1623 templ_7745c5c3_Var83, templ_7745c5c3_Err = templ.ResolveAttributeValue(f.Side)
1624 if templ_7745c5c3_Err != nil {
1625 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 291, Col: 50}
1626 }
1627 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var83)
1628 if templ_7745c5c3_Err != nil {
1629 return templ_7745c5c3_Err
1630 }
1631 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 141, "\">")
1632 if templ_7745c5c3_Err != nil {
1633 return templ_7745c5c3_Err
1634 }
1635 }
1636 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 142, "<div class=\"f-btns\"><button type=\"submit\" class=\"f-main\">[comment]</button> ")
1637 if templ_7745c5c3_Err != nil {
1638 return templ_7745c5c3_Err
1639 }
1640 if f.Cancel != "" {
1641 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 143, "<a href=\"")
1642 if templ_7745c5c3_Err != nil {
1643 return templ_7745c5c3_Err
1644 }
1645 var templ_7745c5c3_Var84 templ.SafeURL
1646 templ_7745c5c3_Var84, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(f.Cancel))
1647 if templ_7745c5c3_Err != nil {
1648 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 296, Col: 37}
1649 }
1650 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var84))
1651 if templ_7745c5c3_Err != nil {
1652 return templ_7745c5c3_Err
1653 }
1654 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 144, "\">[cancel]</a>")
1655 if templ_7745c5c3_Err != nil {
1656 return templ_7745c5c3_Err
1657 }
1658 }
1659 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 145, "</div></form>")
1660 if templ_7745c5c3_Err != nil {
1661 return templ_7745c5c3_Err
1662 }
1663 return nil
1664 })
1665}
1666
1667func mrRail(p MRPage) templ.Component {
1668 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1669 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1670 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1671 return templ_7745c5c3_CtxErr
1672 }
1673 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1674 if !templ_7745c5c3_IsBuffer {
1675 defer func() {
1676 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1677 if templ_7745c5c3_Err == nil {
1678 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1679 }
1680 }()
1681 }
1682 ctx = templ.InitializeContext(ctx)
1683 templ_7745c5c3_Var85 := templ.GetChildren(ctx)
1684 if templ_7745c5c3_Var85 == nil {
1685 templ_7745c5c3_Var85 = templ.NopComponent
1686 }
1687 ctx = templ.ClearChildren(ctx)
1688 if p.Box != nil {
1689 templ_7745c5c3_Err = mergeBox(p).Render(ctx, templ_7745c5c3_Buffer)
1690 if templ_7745c5c3_Err != nil {
1691 return templ_7745c5c3_Err
1692 }
1693 }
1694 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 146, "<section aria-labelledby=\"r-checks\"><h2 id=\"r-checks\">checks <span>0</span></h2><p class=\"dim\">no checks</p><p class=\"mute\">there is no CI yet: nothing blocks the merge.</p></section><section aria-labelledby=\"r-settings\"><h2 id=\"r-settings\">settings</h2><dl class=\"kv\"><dt>modes</dt><dd>")
1695 if templ_7745c5c3_Err != nil {
1696 return templ_7745c5c3_Err
1697 }
1698 var templ_7745c5c3_Var86 string
1699 templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(p.Modes, ", "))
1700 if templ_7745c5c3_Err != nil {
1701 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 315, Col: 36}
1702 }
1703 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86))
1704 if templ_7745c5c3_Err != nil {
1705 return templ_7745c5c3_Err
1706 }
1707 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 147, "</dd><dt>checks</dt><dd>")
1708 if templ_7745c5c3_Err != nil {
1709 return templ_7745c5c3_Err
1710 }
1711 if p.ChecksBlock {
1712 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 148, "failing ones block the merge")
1713 if templ_7745c5c3_Err != nil {
1714 return templ_7745c5c3_Err
1715 }
1716 } else {
1717 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 149, "do not block the merge")
1718 if templ_7745c5c3_Err != nil {
1719 return templ_7745c5c3_Err
1720 }
1721 }
1722 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 150, "</dd></dl></section><section aria-labelledby=\"r-commits\"><h2 id=\"r-commits\">commits <span>")
1723 if templ_7745c5c3_Err != nil {
1724 return templ_7745c5c3_Err
1725 }
1726 var templ_7745c5c3_Var87 string
1727 templ_7745c5c3_Var87, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(p.Commits)))
1728 if templ_7745c5c3_Err != nil {
1729 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 327, Col: 57}
1730 }
1731 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var87))
1732 if templ_7745c5c3_Err != nil {
1733 return templ_7745c5c3_Err
1734 }
1735 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 151, "</span></h2><ul class=\"pcommits\">")
1736 if templ_7745c5c3_Err != nil {
1737 return templ_7745c5c3_Err
1738 }
1739 for _, c := range p.Commits {
1740 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 152, "<li")
1741 if templ_7745c5c3_Err != nil {
1742 return templ_7745c5c3_Err
1743 }
1744 if c.New {
1745 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 153, " data-new")
1746 if templ_7745c5c3_Err != nil {
1747 return templ_7745c5c3_Err
1748 }
1749 }
1750 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 154, "><a href=\"")
1751 if templ_7745c5c3_Err != nil {
1752 return templ_7745c5c3_Err
1753 }
1754 var templ_7745c5c3_Var88 templ.SafeURL
1755 templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(c.Href))
1756 if templ_7745c5c3_Err != nil {
1757 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 331, Col: 36}
1758 }
1759 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88))
1760 if templ_7745c5c3_Err != nil {
1761 return templ_7745c5c3_Err
1762 }
1763 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 155, "\">")
1764 if templ_7745c5c3_Err != nil {
1765 return templ_7745c5c3_Err
1766 }
1767 var templ_7745c5c3_Var89 string
1768 templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(c.Short)
1769 if templ_7745c5c3_Err != nil {
1770 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 331, Col: 48}
1771 }
1772 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89))
1773 if templ_7745c5c3_Err != nil {
1774 return templ_7745c5c3_Err
1775 }
1776 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 156, "</a> <span class=\"s\">")
1777 if templ_7745c5c3_Err != nil {
1778 return templ_7745c5c3_Err
1779 }
1780 var templ_7745c5c3_Var90 string
1781 templ_7745c5c3_Var90, templ_7745c5c3_Err = templ.JoinStringErrs(c.Subject)
1782 if templ_7745c5c3_Err != nil {
1783 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 332, Col: 32}
1784 }
1785 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var90))
1786 if templ_7745c5c3_Err != nil {
1787 return templ_7745c5c3_Err
1788 }
1789 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 157, "</span> <span class=\"mute\">")
1790 if templ_7745c5c3_Err != nil {
1791 return templ_7745c5c3_Err
1792 }
1793 var templ_7745c5c3_Var91 string
1794 templ_7745c5c3_Var91, templ_7745c5c3_Err = templ.JoinStringErrs(c.Author)
1795 if templ_7745c5c3_Err != nil {
1796 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 334, Col: 16}
1797 }
1798 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var91))
1799 if templ_7745c5c3_Err != nil {
1800 return templ_7745c5c3_Err
1801 }
1802 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, " ")
1803 if templ_7745c5c3_Err != nil {
1804 return templ_7745c5c3_Err
1805 }
1806 if c.WhenAt != "" {
1807 var templ_7745c5c3_Var92 string
1808 templ_7745c5c3_Var92, templ_7745c5c3_Err = templ.JoinStringErrs(" · ")
1809 if templ_7745c5c3_Err != nil {
1810 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 336, Col: 15}
1811 }
1812 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var92))
1813 if templ_7745c5c3_Err != nil {
1814 return templ_7745c5c3_Err
1815 }
1816 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "<time datetime=\"")
1817 if templ_7745c5c3_Err != nil {
1818 return templ_7745c5c3_Err
1819 }
1820 var templ_7745c5c3_Var93 string
1821 templ_7745c5c3_Var93, templ_7745c5c3_Err = templ.ResolveAttributeValue(c.WhenAt)
1822 if templ_7745c5c3_Err != nil {
1823 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 336, Col: 42}
1824 }
1825 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var93)
1826 if templ_7745c5c3_Err != nil {
1827 return templ_7745c5c3_Err
1828 }
1829 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "\">")
1830 if templ_7745c5c3_Err != nil {
1831 return templ_7745c5c3_Err
1832 }
1833 var templ_7745c5c3_Var94 string
1834 templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(c.When)
1835 if templ_7745c5c3_Err != nil {
1836 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 336, Col: 53}
1837 }
1838 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94))
1839 if templ_7745c5c3_Err != nil {
1840 return templ_7745c5c3_Err
1841 }
1842 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 161, "</time> ")
1843 if templ_7745c5c3_Err != nil {
1844 return templ_7745c5c3_Err
1845 }
1846 }
1847 if c.New {
1848 var templ_7745c5c3_Var95 string
1849 templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(" · new")
1850 if templ_7745c5c3_Err != nil {
1851 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 339, Col: 18}
1852 }
1853 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95))
1854 if templ_7745c5c3_Err != nil {
1855 return templ_7745c5c3_Err
1856 }
1857 }
1858 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 162, "</span></li>")
1859 if templ_7745c5c3_Err != nil {
1860 return templ_7745c5c3_Err
1861 }
1862 }
1863 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 163, "</ul>")
1864 if templ_7745c5c3_Err != nil {
1865 return templ_7745c5c3_Err
1866 }
1867 if len(p.Commits) == 0 {
1868 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 164, "<p class=\"dim\">no commit to merge.</p>")
1869 if templ_7745c5c3_Err != nil {
1870 return templ_7745c5c3_Err
1871 }
1872 }
1873 if p.CommitsNote != "" {
1874 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 165, "<p class=\"note\">")
1875 if templ_7745c5c3_Err != nil {
1876 return templ_7745c5c3_Err
1877 }
1878 var templ_7745c5c3_Var96 string
1879 templ_7745c5c3_Var96, templ_7745c5c3_Err = templ.JoinStringErrs(p.CommitsNote)
1880 if templ_7745c5c3_Err != nil {
1881 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 349, Col: 34}
1882 }
1883 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var96))
1884 if templ_7745c5c3_Err != nil {
1885 return templ_7745c5c3_Err
1886 }
1887 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 166, "</p>")
1888 if templ_7745c5c3_Err != nil {
1889 return templ_7745c5c3_Err
1890 }
1891 }
1892 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 167, "</section><section aria-labelledby=\"r-files\"><h2 id=\"r-files\">files <span>")
1893 if templ_7745c5c3_Err != nil {
1894 return templ_7745c5c3_Err
1895 }
1896 var templ_7745c5c3_Var97 string
1897 templ_7745c5c3_Var97, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(p.Files)))
1898 if templ_7745c5c3_Err != nil {
1899 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 353, Col: 51}
1900 }
1901 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var97))
1902 if templ_7745c5c3_Err != nil {
1903 return templ_7745c5c3_Err
1904 }
1905 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 168, "</span></h2>")
1906 if templ_7745c5c3_Err != nil {
1907 return templ_7745c5c3_Err
1908 }
1909 templ_7745c5c3_Err = FileList(p.Files).Render(ctx, templ_7745c5c3_Buffer)
1910 if templ_7745c5c3_Err != nil {
1911 return templ_7745c5c3_Err
1912 }
1913 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 169, "</section>")
1914 if templ_7745c5c3_Err != nil {
1915 return templ_7745c5c3_Err
1916 }
1917 return nil
1918 })
1919}
1920
1921// mergeBox is the first block of the rail of an open request, for the owner:
1922// the merge form (it carries the head that was read), the terminal lines, and
1923// the other things one does with the request.
1924func mergeBox(p MRPage) templ.Component {
1925 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
1926 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
1927 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
1928 return templ_7745c5c3_CtxErr
1929 }
1930 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
1931 if !templ_7745c5c3_IsBuffer {
1932 defer func() {
1933 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
1934 if templ_7745c5c3_Err == nil {
1935 templ_7745c5c3_Err = templ_7745c5c3_BufErr
1936 }
1937 }()
1938 }
1939 ctx = templ.InitializeContext(ctx)
1940 templ_7745c5c3_Var98 := templ.GetChildren(ctx)
1941 if templ_7745c5c3_Var98 == nil {
1942 templ_7745c5c3_Var98 = templ.NopComponent
1943 }
1944 ctx = templ.ClearChildren(ctx)
1945 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 170, "<section class=\"decide\" aria-labelledby=\"r-merge\" data-state=\"open\"><h2 id=\"r-merge\">merge</h2><dl class=\"kv\"><dt>head</dt><dd>")
1946 if templ_7745c5c3_Err != nil {
1947 return templ_7745c5c3_Err
1948 }
1949 if p.Box.HeadGone {
1950 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 171, "gone: the source branch was deleted")
1951 if templ_7745c5c3_Err != nil {
1952 return templ_7745c5c3_Err
1953 }
1954 } else {
1955 var templ_7745c5c3_Var99 string
1956 templ_7745c5c3_Var99, templ_7745c5c3_Err = templ.JoinStringErrs(p.HeadShort)
1957 if templ_7745c5c3_Err != nil {
1958 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 370, Col: 18}
1959 }
1960 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var99))
1961 if templ_7745c5c3_Err != nil {
1962 return templ_7745c5c3_Err
1963 }
1964 }
1965 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 172, "</dd><dt>into</dt><dd>")
1966 if templ_7745c5c3_Err != nil {
1967 return templ_7745c5c3_Err
1968 }
1969 var templ_7745c5c3_Var100 string
1970 templ_7745c5c3_Var100, templ_7745c5c3_Err = templ.JoinStringErrs(p.Target)
1971 if templ_7745c5c3_Err != nil {
1972 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 374, Col: 17}
1973 }
1974 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var100))
1975 if templ_7745c5c3_Err != nil {
1976 return templ_7745c5c3_Err
1977 }
1978 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 173, "</dd></dl>")
1979 if templ_7745c5c3_Err != nil {
1980 return templ_7745c5c3_Err
1981 }
1982 if !p.Box.HeadGone {
1983 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 174, "<form class=\"d-acts\" method=\"post\" action=\"")
1984 if templ_7745c5c3_Err != nil {
1985 return templ_7745c5c3_Err
1986 }
1987 var templ_7745c5c3_Var101 templ.SafeURL
1988 templ_7745c5c3_Var101, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Box.MergeAction))
1989 if templ_7745c5c3_Err != nil {
1990 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 377, Col: 79}
1991 }
1992 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var101))
1993 if templ_7745c5c3_Err != nil {
1994 return templ_7745c5c3_Err
1995 }
1996 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 175, "\"><input type=\"hidden\" name=\"head_id\" value=\"")
1997 if templ_7745c5c3_Err != nil {
1998 return templ_7745c5c3_Err
1999 }
2000 var templ_7745c5c3_Var102 string
2001 templ_7745c5c3_Var102, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Box.Head)
2002 if templ_7745c5c3_Err != nil {
2003 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 378, Col: 58}
2004 }
2005 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var102)
2006 if templ_7745c5c3_Err != nil {
2007 return templ_7745c5c3_Err
2008 }
2009 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 176, "\"> <label class=\"sr\" for=\"merge-mode\">merge mode</label> <select id=\"merge-mode\" name=\"mode\">")
2010 if templ_7745c5c3_Err != nil {
2011 return templ_7745c5c3_Err
2012 }
2013 for _, m := range p.Box.Modes {
2014 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 177, "<option value=\"")
2015 if templ_7745c5c3_Err != nil {
2016 return templ_7745c5c3_Err
2017 }
2018 var templ_7745c5c3_Var103 string
2019 templ_7745c5c3_Var103, templ_7745c5c3_Err = templ.ResolveAttributeValue(m.Value)
2020 if templ_7745c5c3_Err != nil {
2021 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 382, Col: 29}
2022 }
2023 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var103)
2024 if templ_7745c5c3_Err != nil {
2025 return templ_7745c5c3_Err
2026 }
2027 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 178, "\">")
2028 if templ_7745c5c3_Err != nil {
2029 return templ_7745c5c3_Err
2030 }
2031 var templ_7745c5c3_Var104 string
2032 templ_7745c5c3_Var104, templ_7745c5c3_Err = templ.JoinStringErrs(m.Label)
2033 if templ_7745c5c3_Err != nil {
2034 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 382, Col: 41}
2035 }
2036 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var104))
2037 if templ_7745c5c3_Err != nil {
2038 return templ_7745c5c3_Err
2039 }
2040 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 179, "</option>")
2041 if templ_7745c5c3_Err != nil {
2042 return templ_7745c5c3_Err
2043 }
2044 }
2045 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 180, "</select><div class=\"d-btns\"><button type=\"submit\" class=\"d-main\">[merge]</button></div></form>")
2046 if templ_7745c5c3_Err != nil {
2047 return templ_7745c5c3_Err
2048 }
2049 }
2050 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 181, "<div class=\"d-btns\">")
2051 if templ_7745c5c3_Err != nil {
2052 return templ_7745c5c3_Err
2053 }
2054 if p.Box.CanMarkRead {
2055 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 182, "<form method=\"post\" action=\"")
2056 if templ_7745c5c3_Err != nil {
2057 return templ_7745c5c3_Err
2058 }
2059 var templ_7745c5c3_Var105 templ.SafeURL
2060 templ_7745c5c3_Var105, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Box.ReadAction))
2061 if templ_7745c5c3_Err != nil {
2062 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 392, Col: 64}
2063 }
2064 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var105))
2065 if templ_7745c5c3_Err != nil {
2066 return templ_7745c5c3_Err
2067 }
2068 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 183, "\"><input type=\"hidden\" name=\"head_id\" value=\"")
2069 if templ_7745c5c3_Err != nil {
2070 return templ_7745c5c3_Err
2071 }
2072 var templ_7745c5c3_Var106 string
2073 templ_7745c5c3_Var106, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Box.Head)
2074 if templ_7745c5c3_Err != nil {
2075 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 393, Col: 59}
2076 }
2077 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var106)
2078 if templ_7745c5c3_Err != nil {
2079 return templ_7745c5c3_Err
2080 }
2081 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 184, "\"> <button type=\"submit\" title=\"the next visit can show only what changed after this head\">[mark read]</button></form>")
2082 if templ_7745c5c3_Err != nil {
2083 return templ_7745c5c3_Err
2084 }
2085 }
2086 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 185, "<form method=\"post\" action=\"")
2087 if templ_7745c5c3_Err != nil {
2088 return templ_7745c5c3_Err
2089 }
2090 var templ_7745c5c3_Var107 templ.SafeURL
2091 templ_7745c5c3_Var107, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Box.CloseAction))
2092 if templ_7745c5c3_Err != nil {
2093 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 397, Col: 64}
2094 }
2095 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var107))
2096 if templ_7745c5c3_Err != nil {
2097 return templ_7745c5c3_Err
2098 }
2099 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 186, "\"><button type=\"submit\" title=\"close without merging; the branch is kept\">[close]</button></form></div>")
2100 if templ_7745c5c3_Err != nil {
2101 return templ_7745c5c3_Err
2102 }
2103 if !p.Box.HeadGone {
2104 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 187, "<p class=\"mute d-or\">or from a terminal</p>")
2105 if templ_7745c5c3_Err != nil {
2106 return templ_7745c5c3_Err
2107 }
2108 templ_7745c5c3_Err = CloneBlock(p.Box.CLI).Render(ctx, templ_7745c5c3_Buffer)
2109 if templ_7745c5c3_Err != nil {
2110 return templ_7745c5c3_Err
2111 }
2112 }
2113 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 188, "</section>")
2114 if templ_7745c5c3_Err != nil {
2115 return templ_7745c5c3_Err
2116 }
2117 return nil
2118 })
2119}
2120
2121// Compare is a branch against the default branch: the commits it is ahead by,
2122// its diff when the API can give one, and the form that opens a merge request.
2123func Compare(l Layout, p ComparePage) templ.Component {
2124 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
2125 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
2126 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
2127 return templ_7745c5c3_CtxErr
2128 }
2129 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2130 if !templ_7745c5c3_IsBuffer {
2131 defer func() {
2132 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
2133 if templ_7745c5c3_Err == nil {
2134 templ_7745c5c3_Err = templ_7745c5c3_BufErr
2135 }
2136 }()
2137 }
2138 ctx = templ.InitializeContext(ctx)
2139 templ_7745c5c3_Var108 := templ.GetChildren(ctx)
2140 if templ_7745c5c3_Var108 == nil {
2141 templ_7745c5c3_Var108 = templ.NopComponent
2142 }
2143 ctx = templ.ClearChildren(ctx)
2144 templ_7745c5c3_Var109 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
2145 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
2146 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2147 if !templ_7745c5c3_IsBuffer {
2148 defer func() {
2149 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
2150 if templ_7745c5c3_Err == nil {
2151 templ_7745c5c3_Err = templ_7745c5c3_BufErr
2152 }
2153 }()
2154 }
2155 ctx = templ.InitializeContext(ctx)
2156 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 189, "<header class=\"show mr-h\"><h1>")
2157 if templ_7745c5c3_Err != nil {
2158 return templ_7745c5c3_Err
2159 }
2160 var templ_7745c5c3_Var110 string
2161 templ_7745c5c3_Var110, templ_7745c5c3_Err = templ.JoinStringErrs(p.Source)
2162 if templ_7745c5c3_Err != nil {
2163 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 413, Col: 17}
2164 }
2165 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var110))
2166 if templ_7745c5c3_Err != nil {
2167 return templ_7745c5c3_Err
2168 }
2169 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 190, " → ")
2170 if templ_7745c5c3_Err != nil {
2171 return templ_7745c5c3_Err
2172 }
2173 var templ_7745c5c3_Var111 string
2174 templ_7745c5c3_Var111, templ_7745c5c3_Err = templ.JoinStringErrs(p.Target)
2175 if templ_7745c5c3_Err != nil {
2176 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 413, Col: 34}
2177 }
2178 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var111))
2179 if templ_7745c5c3_Err != nil {
2180 return templ_7745c5c3_Err
2181 }
2182 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 191, "</h1><dl class=\"kv show-kv\"><dt>branch</dt><dd><a href=\"")
2183 if templ_7745c5c3_Err != nil {
2184 return templ_7745c5c3_Err
2185 }
2186 var templ_7745c5c3_Var112 templ.SafeURL
2187 templ_7745c5c3_Var112, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.SourceHref))
2188 if templ_7745c5c3_Err != nil {
2189 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 416, Col: 45}
2190 }
2191 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var112))
2192 if templ_7745c5c3_Err != nil {
2193 return templ_7745c5c3_Err
2194 }
2195 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 192, "\">")
2196 if templ_7745c5c3_Err != nil {
2197 return templ_7745c5c3_Err
2198 }
2199 var templ_7745c5c3_Var113 string
2200 templ_7745c5c3_Var113, templ_7745c5c3_Err = templ.JoinStringErrs(p.Source)
2201 if templ_7745c5c3_Err != nil {
2202 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 416, Col: 58}
2203 }
2204 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var113))
2205 if templ_7745c5c3_Err != nil {
2206 return templ_7745c5c3_Err
2207 }
2208 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 193, "</a></dd><dt>target</dt><dd><a href=\"")
2209 if templ_7745c5c3_Err != nil {
2210 return templ_7745c5c3_Err
2211 }
2212 var templ_7745c5c3_Var114 templ.SafeURL
2213 templ_7745c5c3_Var114, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.TargetHref))
2214 if templ_7745c5c3_Err != nil {
2215 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 418, Col: 45}
2216 }
2217 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var114))
2218 if templ_7745c5c3_Err != nil {
2219 return templ_7745c5c3_Err
2220 }
2221 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 194, "\">")
2222 if templ_7745c5c3_Err != nil {
2223 return templ_7745c5c3_Err
2224 }
2225 var templ_7745c5c3_Var115 string
2226 templ_7745c5c3_Var115, templ_7745c5c3_Err = templ.JoinStringErrs(p.Target)
2227 if templ_7745c5c3_Err != nil {
2228 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 418, Col: 58}
2229 }
2230 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var115))
2231 if templ_7745c5c3_Err != nil {
2232 return templ_7745c5c3_Err
2233 }
2234 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 195, "</a></dd><dt>ahead</dt><dd>")
2235 if templ_7745c5c3_Err != nil {
2236 return templ_7745c5c3_Err
2237 }
2238 var templ_7745c5c3_Var116 string
2239 templ_7745c5c3_Var116, templ_7745c5c3_Err = templ.JoinStringErrs(p.AheadText)
2240 if templ_7745c5c3_Err != nil {
2241 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 420, Col: 21}
2242 }
2243 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var116))
2244 if templ_7745c5c3_Err != nil {
2245 return templ_7745c5c3_Err
2246 }
2247 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 196, "</dd></dl></header>")
2248 if templ_7745c5c3_Err != nil {
2249 return templ_7745c5c3_Err
2250 }
2251 if p.Note != "" {
2252 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 197, "<p class=\"notice\">")
2253 if templ_7745c5c3_Err != nil {
2254 return templ_7745c5c3_Err
2255 }
2256 var templ_7745c5c3_Var117 string
2257 templ_7745c5c3_Var117, templ_7745c5c3_Err = templ.JoinStringErrs(p.Note)
2258 if templ_7745c5c3_Err != nil {
2259 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 424, Col: 29}
2260 }
2261 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var117))
2262 if templ_7745c5c3_Err != nil {
2263 return templ_7745c5c3_Err
2264 }
2265 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 198, "</p>")
2266 if templ_7745c5c3_Err != nil {
2267 return templ_7745c5c3_Err
2268 }
2269 }
2270 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 199, " ")
2271 if templ_7745c5c3_Err != nil {
2272 return templ_7745c5c3_Err
2273 }
2274 if p.Existing != nil {
2275 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 200, "<p class=\"notice\">an open merge request already covers these branches: <a href=\"")
2276 if templ_7745c5c3_Err != nil {
2277 return templ_7745c5c3_Err
2278 }
2279 var templ_7745c5c3_Var118 templ.SafeURL
2280 templ_7745c5c3_Var118, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Existing.Href))
2281 if templ_7745c5c3_Err != nil {
2282 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 427, Col: 114}
2283 }
2284 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var118))
2285 if templ_7745c5c3_Err != nil {
2286 return templ_7745c5c3_Err
2287 }
2288 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 201, "\">")
2289 if templ_7745c5c3_Err != nil {
2290 return templ_7745c5c3_Err
2291 }
2292 var templ_7745c5c3_Var119 string
2293 templ_7745c5c3_Var119, templ_7745c5c3_Err = templ.JoinStringErrs(p.Existing.Label)
2294 if templ_7745c5c3_Err != nil {
2295 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 427, Col: 135}
2296 }
2297 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var119))
2298 if templ_7745c5c3_Err != nil {
2299 return templ_7745c5c3_Err
2300 }
2301 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 202, "</a></p>")
2302 if templ_7745c5c3_Err != nil {
2303 return templ_7745c5c3_Err
2304 }
2305 }
2306 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 203, " ")
2307 if templ_7745c5c3_Err != nil {
2308 return templ_7745c5c3_Err
2309 }
2310 if p.Create != nil {
2311 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 204, "<form class=\"cform create\" method=\"post\" action=\"")
2312 if templ_7745c5c3_Err != nil {
2313 return templ_7745c5c3_Err
2314 }
2315 var templ_7745c5c3_Var120 templ.SafeURL
2316 templ_7745c5c3_Var120, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Create.Action))
2317 if templ_7745c5c3_Err != nil {
2318 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 430, Col: 83}
2319 }
2320 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var120))
2321 if templ_7745c5c3_Err != nil {
2322 return templ_7745c5c3_Err
2323 }
2324 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 205, "\"><input type=\"hidden\" name=\"source\" value=\"")
2325 if templ_7745c5c3_Err != nil {
2326 return templ_7745c5c3_Err
2327 }
2328 var templ_7745c5c3_Var121 string
2329 templ_7745c5c3_Var121, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Create.Source)
2330 if templ_7745c5c3_Err != nil {
2331 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 431, Col: 62}
2332 }
2333 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var121)
2334 if templ_7745c5c3_Err != nil {
2335 return templ_7745c5c3_Err
2336 }
2337 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 206, "\"> <input type=\"hidden\" name=\"target\" value=\"")
2338 if templ_7745c5c3_Err != nil {
2339 return templ_7745c5c3_Err
2340 }
2341 var templ_7745c5c3_Var122 string
2342 templ_7745c5c3_Var122, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Create.Target)
2343 if templ_7745c5c3_Err != nil {
2344 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 432, Col: 62}
2345 }
2346 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var122)
2347 if templ_7745c5c3_Err != nil {
2348 return templ_7745c5c3_Err
2349 }
2350 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 207, "\"> <label for=\"mr-title\">title</label> <input id=\"mr-title\" name=\"title\" type=\"text\" maxlength=\"120\" required value=\"")
2351 if templ_7745c5c3_Err != nil {
2352 return templ_7745c5c3_Err
2353 }
2354 var templ_7745c5c3_Var123 string
2355 templ_7745c5c3_Var123, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Create.Title)
2356 if templ_7745c5c3_Err != nil {
2357 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 434, Col: 97}
2358 }
2359 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var123)
2360 if templ_7745c5c3_Err != nil {
2361 return templ_7745c5c3_Err
2362 }
2363 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 208, "\" autocomplete=\"off\"> <label for=\"mr-desc\">description</label> <textarea id=\"mr-desc\" name=\"description\" rows=\"4\" maxlength=\"8000\" placeholder=\"plain text, optional\"></textarea><div class=\"f-btns\"><button type=\"submit\" class=\"f-main\">[create merge request]</button></div></form>")
2364 if templ_7745c5c3_Err != nil {
2365 return templ_7745c5c3_Err
2366 }
2367 }
2368 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 209, " ")
2369 if templ_7745c5c3_Err != nil {
2370 return templ_7745c5c3_Err
2371 }
2372 if p.HasDiff {
2373 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 210, "<div class=\"diff-tools\" role=\"toolbar\" aria-label=\"Diff view\"><span class=\"dim\">")
2374 if templ_7745c5c3_Err != nil {
2375 return templ_7745c5c3_Err
2376 }
2377 var templ_7745c5c3_Var124 string
2378 templ_7745c5c3_Var124, templ_7745c5c3_Err = templ.JoinStringErrs(plural(p.NFiles, "file", "files"))
2379 if templ_7745c5c3_Err != nil {
2380 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 444, Col: 57}
2381 }
2382 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var124))
2383 if templ_7745c5c3_Err != nil {
2384 return templ_7745c5c3_Err
2385 }
2386 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 211, " · <span class=\"plus\">+")
2387 if templ_7745c5c3_Err != nil {
2388 return templ_7745c5c3_Err
2389 }
2390 var templ_7745c5c3_Var125 string
2391 templ_7745c5c3_Var125, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.Adds))
2392 if templ_7745c5c3_Err != nil {
2393 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 444, Col: 97}
2394 }
2395 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var125))
2396 if templ_7745c5c3_Err != nil {
2397 return templ_7745c5c3_Err
2398 }
2399 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 212, "</span> <span class=\"minus\">-")
2400 if templ_7745c5c3_Err != nil {
2401 return templ_7745c5c3_Err
2402 }
2403 var templ_7745c5c3_Var126 string
2404 templ_7745c5c3_Var126, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.Dels))
2405 if templ_7745c5c3_Err != nil {
2406 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 444, Col: 142}
2407 }
2408 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var126))
2409 if templ_7745c5c3_Err != nil {
2410 return templ_7745c5c3_Err
2411 }
2412 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 213, "</span></span> <span class=\"grow\"></span>")
2413 if templ_7745c5c3_Err != nil {
2414 return templ_7745c5c3_Err
2415 }
2416 templ_7745c5c3_Err = viewLink(p.DiffView, "unified", "[u]nified", "u", p.UnifiedHref).Render(ctx, templ_7745c5c3_Buffer)
2417 if templ_7745c5c3_Err != nil {
2418 return templ_7745c5c3_Err
2419 }
2420 templ_7745c5c3_Err = viewLink(p.DiffView, "split", "[d] split", "d", p.SplitHref).Render(ctx, templ_7745c5c3_Buffer)
2421 if templ_7745c5c3_Err != nil {
2422 return templ_7745c5c3_Err
2423 }
2424 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 214, "<button type=\"button\" aria-keyshortcuts=\"x\" hx-on:click=\"document.body.dispatchEvent(new CustomEvent('k-collapse'))\">[x] collapse all</button></div>")
2425 if templ_7745c5c3_Err != nil {
2426 return templ_7745c5c3_Err
2427 }
2428 if p.Invisible {
2429 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 215, "<p class=\"notice\">this diff holds invisible characters (direction controls, zero-width characters). They are shown as <span class=\"inv\"><U+XXXX></span> markers, never applied.</p>")
2430 if templ_7745c5c3_Err != nil {
2431 return templ_7745c5c3_Err
2432 }
2433 }
2434 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 216, " <div id=\"diffs\"")
2435 if templ_7745c5c3_Err != nil {
2436 return templ_7745c5c3_Err
2437 }
2438 if p.Both {
2439 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 217, " data-diff=\"")
2440 if templ_7745c5c3_Err != nil {
2441 return templ_7745c5c3_Err
2442 }
2443 var templ_7745c5c3_Var127 string
2444 templ_7745c5c3_Var127, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.View)
2445 if templ_7745c5c3_Err != nil {
2446 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 459, Col: 23}
2447 }
2448 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var127)
2449 if templ_7745c5c3_Err != nil {
2450 return templ_7745c5c3_Err
2451 }
2452 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 218, "\"")
2453 if templ_7745c5c3_Err != nil {
2454 return templ_7745c5c3_Err
2455 }
2456 } else {
2457 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 219, " data-view=\"")
2458 if templ_7745c5c3_Err != nil {
2459 return templ_7745c5c3_Err
2460 }
2461 var templ_7745c5c3_Var128 string
2462 templ_7745c5c3_Var128, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.View)
2463 if templ_7745c5c3_Err != nil {
2464 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 461, Col: 23}
2465 }
2466 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var128)
2467 if templ_7745c5c3_Err != nil {
2468 return templ_7745c5c3_Err
2469 }
2470 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 220, "\"")
2471 if templ_7745c5c3_Err != nil {
2472 return templ_7745c5c3_Err
2473 }
2474 }
2475 if p.Both && !p.Pinned {
2476 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 221, " hx-live=\"this.dataset.diff = sessionStorage.getItem('diff') || this.dataset.diff\"")
2477 if templ_7745c5c3_Err != nil {
2478 return templ_7745c5c3_Err
2479 }
2480 }
2481 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 222, ">")
2482 if templ_7745c5c3_Err != nil {
2483 return templ_7745c5c3_Err
2484 }
2485 for _, f := range p.Files {
2486 templ_7745c5c3_Err = DiffFileView(f, p.DiffView).Render(ctx, templ_7745c5c3_Buffer)
2487 if templ_7745c5c3_Err != nil {
2488 return templ_7745c5c3_Err
2489 }
2490 }
2491 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 223, "</div>")
2492 if templ_7745c5c3_Err != nil {
2493 return templ_7745c5c3_Err
2494 }
2495 }
2496 return nil
2497 })
2498 templ_7745c5c3_Err = Shell(l, compareRail(p)).Render(templ.WithChildren(ctx, templ_7745c5c3_Var109), templ_7745c5c3_Buffer)
2499 if templ_7745c5c3_Err != nil {
2500 return templ_7745c5c3_Err
2501 }
2502 return nil
2503 })
2504}
2505
2506func compareRail(p ComparePage) templ.Component {
2507 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
2508 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
2509 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
2510 return templ_7745c5c3_CtxErr
2511 }
2512 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2513 if !templ_7745c5c3_IsBuffer {
2514 defer func() {
2515 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
2516 if templ_7745c5c3_Err == nil {
2517 templ_7745c5c3_Err = templ_7745c5c3_BufErr
2518 }
2519 }()
2520 }
2521 ctx = templ.InitializeContext(ctx)
2522 templ_7745c5c3_Var129 := templ.GetChildren(ctx)
2523 if templ_7745c5c3_Var129 == nil {
2524 templ_7745c5c3_Var129 = templ.NopComponent
2525 }
2526 ctx = templ.ClearChildren(ctx)
2527 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 224, "<section aria-labelledby=\"r-ahead\"><h2 id=\"r-ahead\">commits <span>")
2528 if templ_7745c5c3_Err != nil {
2529 return templ_7745c5c3_Err
2530 }
2531 var templ_7745c5c3_Var130 string
2532 templ_7745c5c3_Var130, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(p.Ahead)))
2533 if templ_7745c5c3_Err != nil {
2534 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 477, Col: 53}
2535 }
2536 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var130))
2537 if templ_7745c5c3_Err != nil {
2538 return templ_7745c5c3_Err
2539 }
2540 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 225, "</span></h2><ul class=\"pcommits\">")
2541 if templ_7745c5c3_Err != nil {
2542 return templ_7745c5c3_Err
2543 }
2544 for _, c := range p.Ahead {
2545 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 226, "<li><a href=\"")
2546 if templ_7745c5c3_Err != nil {
2547 return templ_7745c5c3_Err
2548 }
2549 var templ_7745c5c3_Var131 templ.SafeURL
2550 templ_7745c5c3_Var131, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(c.CHref))
2551 if templ_7745c5c3_Err != nil {
2552 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 481, Col: 37}
2553 }
2554 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var131))
2555 if templ_7745c5c3_Err != nil {
2556 return templ_7745c5c3_Err
2557 }
2558 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 227, "\">")
2559 if templ_7745c5c3_Err != nil {
2560 return templ_7745c5c3_Err
2561 }
2562 var templ_7745c5c3_Var132 string
2563 templ_7745c5c3_Var132, templ_7745c5c3_Err = templ.JoinStringErrs(c.Short)
2564 if templ_7745c5c3_Err != nil {
2565 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 481, Col: 49}
2566 }
2567 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var132))
2568 if templ_7745c5c3_Err != nil {
2569 return templ_7745c5c3_Err
2570 }
2571 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 228, "</a> <span class=\"s\">")
2572 if templ_7745c5c3_Err != nil {
2573 return templ_7745c5c3_Err
2574 }
2575 var templ_7745c5c3_Var133 string
2576 templ_7745c5c3_Var133, templ_7745c5c3_Err = templ.JoinStringErrs(c.Subject)
2577 if templ_7745c5c3_Err != nil {
2578 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 482, Col: 32}
2579 }
2580 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var133))
2581 if templ_7745c5c3_Err != nil {
2582 return templ_7745c5c3_Err
2583 }
2584 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 229, "</span> <span class=\"mute\">")
2585 if templ_7745c5c3_Err != nil {
2586 return templ_7745c5c3_Err
2587 }
2588 var templ_7745c5c3_Var134 string
2589 templ_7745c5c3_Var134, templ_7745c5c3_Err = templ.JoinStringErrs(c.Author)
2590 if templ_7745c5c3_Err != nil {
2591 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 484, Col: 16}
2592 }
2593 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var134))
2594 if templ_7745c5c3_Err != nil {
2595 return templ_7745c5c3_Err
2596 }
2597 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 230, " ")
2598 if templ_7745c5c3_Err != nil {
2599 return templ_7745c5c3_Err
2600 }
2601 if c.WhenAt != "" {
2602 var templ_7745c5c3_Var135 string
2603 templ_7745c5c3_Var135, templ_7745c5c3_Err = templ.JoinStringErrs(" · ")
2604 if templ_7745c5c3_Err != nil {
2605 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 486, Col: 15}
2606 }
2607 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var135))
2608 if templ_7745c5c3_Err != nil {
2609 return templ_7745c5c3_Err
2610 }
2611 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 231, "<time datetime=\"")
2612 if templ_7745c5c3_Err != nil {
2613 return templ_7745c5c3_Err
2614 }
2615 var templ_7745c5c3_Var136 string
2616 templ_7745c5c3_Var136, templ_7745c5c3_Err = templ.ResolveAttributeValue(c.WhenAt)
2617 if templ_7745c5c3_Err != nil {
2618 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 486, Col: 42}
2619 }
2620 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var136)
2621 if templ_7745c5c3_Err != nil {
2622 return templ_7745c5c3_Err
2623 }
2624 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 232, "\">")
2625 if templ_7745c5c3_Err != nil {
2626 return templ_7745c5c3_Err
2627 }
2628 var templ_7745c5c3_Var137 string
2629 templ_7745c5c3_Var137, templ_7745c5c3_Err = templ.JoinStringErrs(c.When)
2630 if templ_7745c5c3_Err != nil {
2631 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 486, Col: 53}
2632 }
2633 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var137))
2634 if templ_7745c5c3_Err != nil {
2635 return templ_7745c5c3_Err
2636 }
2637 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 233, "</time>")
2638 if templ_7745c5c3_Err != nil {
2639 return templ_7745c5c3_Err
2640 }
2641 }
2642 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 234, "</span></li>")
2643 if templ_7745c5c3_Err != nil {
2644 return templ_7745c5c3_Err
2645 }
2646 }
2647 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 235, "</ul>")
2648 if templ_7745c5c3_Err != nil {
2649 return templ_7745c5c3_Err
2650 }
2651 if len(p.Ahead) == 0 {
2652 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 236, "<p class=\"dim\">no commit ahead of ")
2653 if templ_7745c5c3_Err != nil {
2654 return templ_7745c5c3_Err
2655 }
2656 var templ_7745c5c3_Var138 string
2657 templ_7745c5c3_Var138, templ_7745c5c3_Err = templ.JoinStringErrs(p.Target)
2658 if templ_7745c5c3_Err != nil {
2659 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 493, Col: 47}
2660 }
2661 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var138))
2662 if templ_7745c5c3_Err != nil {
2663 return templ_7745c5c3_Err
2664 }
2665 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 237, ".</p>")
2666 if templ_7745c5c3_Err != nil {
2667 return templ_7745c5c3_Err
2668 }
2669 }
2670 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 238, "</section>")
2671 if templ_7745c5c3_Err != nil {
2672 return templ_7745c5c3_Err
2673 }
2674 if p.HasDiff {
2675 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 239, "<section aria-labelledby=\"r-files\"><h2 id=\"r-files\">files <span>")
2676 if templ_7745c5c3_Err != nil {
2677 return templ_7745c5c3_Err
2678 }
2679 var templ_7745c5c3_Var139 string
2680 templ_7745c5c3_Var139, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(len(p.Files)))
2681 if templ_7745c5c3_Err != nil {
2682 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/mr.templ`, Line: 498, Col: 52}
2683 }
2684 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var139))
2685 if templ_7745c5c3_Err != nil {
2686 return templ_7745c5c3_Err
2687 }
2688 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 240, "</span></h2>")
2689 if templ_7745c5c3_Err != nil {
2690 return templ_7745c5c3_Err
2691 }
2692 templ_7745c5c3_Err = FileList(p.Files).Render(ctx, templ_7745c5c3_Buffer)
2693 if templ_7745c5c3_Err != nil {
2694 return templ_7745c5c3_Err
2695 }
2696 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 241, "</section>")
2697 if templ_7745c5c3_Err != nil {
2698 return templ_7745c5c3_Err
2699 }
2700 }
2701 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 242, "<section aria-labelledby=\"r-cli\"><h2 id=\"r-cli\">from a terminal</h2>")
2702 if templ_7745c5c3_Err != nil {
2703 return templ_7745c5c3_Err
2704 }
2705 templ_7745c5c3_Err = CloneBlock(p.CLI).Render(ctx, templ_7745c5c3_Buffer)
2706 if templ_7745c5c3_Err != nil {
2707 return templ_7745c5c3_Err
2708 }
2709 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 243, "</section>")
2710 if templ_7745c5c3_Err != nil {
2711 return templ_7745c5c3_Err
2712 }
2713 return nil
2714 })
2715}
2716
2717var _ = templruntime.GeneratedTemplate