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