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