| @@ -0,0 +1,421 @@ |
| 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 | + | |
| 6 | + | package web |
| 7 | + | |
| 8 | + | //lint:file-ignore SA4006 This context is only used if a nested component is present. |
| 9 | + | |
| 10 | + | import "github.com/a-h/templ" |
| 11 | + | import templruntime "github.com/a-h/templ/runtime" |
| 12 | + | |
| 13 | + | // IssueForm is the public form that proposes an issue to the owner. It needs |
| 14 | + | // JavaScript: the script (issue-form.js) solves a proof of work in a worker, |
| 15 | + | // so the form stays hidden until it runs, and the page says why without it. |
| 16 | + | func IssueForm(l Layout, p IssueFormPage) templ.Component { |
| 17 | + | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 18 | + | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 19 | + | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 20 | + | return templ_7745c5c3_CtxErr |
| 21 | + | } |
| 22 | + | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 23 | + | if !templ_7745c5c3_IsBuffer { |
| 24 | + | defer func() { |
| 25 | + | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 26 | + | if templ_7745c5c3_Err == nil { |
| 27 | + | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 28 | + | } |
| 29 | + | }() |
| 30 | + | } |
| 31 | + | ctx = templ.InitializeContext(ctx) |
| 32 | + | templ_7745c5c3_Var1 := templ.GetChildren(ctx) |
| 33 | + | if templ_7745c5c3_Var1 == nil { |
| 34 | + | templ_7745c5c3_Var1 = templ.NopComponent |
| 35 | + | } |
| 36 | + | ctx = templ.ClearChildren(ctx) |
| 37 | + | templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 38 | + | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 39 | + | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 40 | + | if !templ_7745c5c3_IsBuffer { |
| 41 | + | defer func() { |
| 42 | + | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 43 | + | if templ_7745c5c3_Err == nil { |
| 44 | + | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 45 | + | } |
| 46 | + | }() |
| 47 | + | } |
| 48 | + | ctx = templ.InitializeContext(ctx) |
| 49 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<header class=\"show mr-h\"><h1>New issue</h1></header><noscript><p class=\"lede\">This form needs JavaScript: it runs a short proof of work so that bots cannot flood the tracker.</p></noscript><form class=\"cform create\" method=\"post\" action=\"") |
| 50 | + | if templ_7745c5c3_Err != nil { |
| 51 | + | return templ_7745c5c3_Err |
| 52 | + | } |
| 53 | + | var templ_7745c5c3_Var3 templ.SafeURL |
| 54 | + | templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Action)) |
| 55 | + | if templ_7745c5c3_Err != nil { |
| 56 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 19, Col: 35} |
| 57 | + | } |
| 58 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) |
| 59 | + | if templ_7745c5c3_Err != nil { |
| 60 | + | return templ_7745c5c3_Err |
| 61 | + | } |
| 62 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" hidden data-issue-form data-nonce=\"") |
| 63 | + | if templ_7745c5c3_Err != nil { |
| 64 | + | return templ_7745c5c3_Err |
| 65 | + | } |
| 66 | + | var templ_7745c5c3_Var4 string |
| 67 | + | templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Nonce) |
| 68 | + | if templ_7745c5c3_Err != nil { |
| 69 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 22, Col: 23} |
| 70 | + | } |
| 71 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4) |
| 72 | + | if templ_7745c5c3_Err != nil { |
| 73 | + | return templ_7745c5c3_Err |
| 74 | + | } |
| 75 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" data-difficulty=\"") |
| 76 | + | if templ_7745c5c3_Err != nil { |
| 77 | + | return templ_7745c5c3_Err |
| 78 | + | } |
| 79 | + | var templ_7745c5c3_Var5 string |
| 80 | + | templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.ResolveAttributeValue(itoa(p.Difficulty)) |
| 81 | + | if templ_7745c5c3_Err != nil { |
| 82 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 23, Col: 39} |
| 83 | + | } |
| 84 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5) |
| 85 | + | if templ_7745c5c3_Err != nil { |
| 86 | + | return templ_7745c5c3_Err |
| 87 | + | } |
| 88 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" data-min-submit-at=\"") |
| 89 | + | if templ_7745c5c3_Err != nil { |
| 90 | + | return templ_7745c5c3_Err |
| 91 | + | } |
| 92 | + | var templ_7745c5c3_Var6 string |
| 93 | + | templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.ResolveAttributeValue(i64(p.MinSubmitAt)) |
| 94 | + | if templ_7745c5c3_Err != nil { |
| 95 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 24, Col: 42} |
| 96 | + | } |
| 97 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6) |
| 98 | + | if templ_7745c5c3_Err != nil { |
| 99 | + | return templ_7745c5c3_Err |
| 100 | + | } |
| 101 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" data-worker=\"") |
| 102 | + | if templ_7745c5c3_Err != nil { |
| 103 | + | return templ_7745c5c3_Err |
| 104 | + | } |
| 105 | + | var templ_7745c5c3_Var7 string |
| 106 | + | templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Worker) |
| 107 | + | if templ_7745c5c3_Err != nil { |
| 108 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 25, Col: 25} |
| 109 | + | } |
| 110 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7) |
| 111 | + | if templ_7745c5c3_Err != nil { |
| 112 | + | return templ_7745c5c3_Err |
| 113 | + | } |
| 114 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\" autocomplete=\"off\"><input type=\"hidden\" name=\"token\" value=\"") |
| 115 | + | if templ_7745c5c3_Err != nil { |
| 116 | + | return templ_7745c5c3_Err |
| 117 | + | } |
| 118 | + | var templ_7745c5c3_Var8 string |
| 119 | + | templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Token) |
| 120 | + | if templ_7745c5c3_Err != nil { |
| 121 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 28, Col: 52} |
| 122 | + | } |
| 123 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8) |
| 124 | + | if templ_7745c5c3_Err != nil { |
| 125 | + | return templ_7745c5c3_Err |
| 126 | + | } |
| 127 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\"> <input type=\"hidden\" name=\"form_token\" value=\"") |
| 128 | + | if templ_7745c5c3_Err != nil { |
| 129 | + | return templ_7745c5c3_Err |
| 130 | + | } |
| 131 | + | var templ_7745c5c3_Var9 string |
| 132 | + | templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.FormToken) |
| 133 | + | if templ_7745c5c3_Err != nil { |
| 134 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 29, Col: 61} |
| 135 | + | } |
| 136 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9) |
| 137 | + | if templ_7745c5c3_Err != nil { |
| 138 | + | return templ_7745c5c3_Err |
| 139 | + | } |
| 140 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\"> <input type=\"hidden\" name=\"solution\" value=\"\"> <label for=\"issue-title\">title</label> <input id=\"issue-title\" name=\"title\" type=\"text\" required autocomplete=\"off\" value=\"") |
| 141 | + | if templ_7745c5c3_Err != nil { |
| 142 | + | return templ_7745c5c3_Err |
| 143 | + | } |
| 144 | + | var templ_7745c5c3_Var10 string |
| 145 | + | templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Title) |
| 146 | + | if templ_7745c5c3_Err != nil { |
| 147 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 32, Col: 95} |
| 148 | + | } |
| 149 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10) |
| 150 | + | if templ_7745c5c3_Err != nil { |
| 151 | + | return templ_7745c5c3_Err |
| 152 | + | } |
| 153 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\"> <output data-for=\"issue-title\" data-max=\"") |
| 154 | + | if templ_7745c5c3_Err != nil { |
| 155 | + | return templ_7745c5c3_Err |
| 156 | + | } |
| 157 | + | var templ_7745c5c3_Var11 string |
| 158 | + | templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.ResolveAttributeValue(itoa(p.MaxTitle)) |
| 159 | + | if templ_7745c5c3_Err != nil { |
| 160 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 33, Col: 61} |
| 161 | + | } |
| 162 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11) |
| 163 | + | if templ_7745c5c3_Err != nil { |
| 164 | + | return templ_7745c5c3_Err |
| 165 | + | } |
| 166 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" for=\"issue-title\">") |
| 167 | + | if templ_7745c5c3_Err != nil { |
| 168 | + | return templ_7745c5c3_Err |
| 169 | + | } |
| 170 | + | var templ_7745c5c3_Var12 string |
| 171 | + | templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(runeCount(p.Title))) |
| 172 | + | if templ_7745c5c3_Err != nil { |
| 173 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 33, Col: 108} |
| 174 | + | } |
| 175 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) |
| 176 | + | if templ_7745c5c3_Err != nil { |
| 177 | + | return templ_7745c5c3_Err |
| 178 | + | } |
| 179 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, " / ") |
| 180 | + | if templ_7745c5c3_Err != nil { |
| 181 | + | return templ_7745c5c3_Err |
| 182 | + | } |
| 183 | + | var templ_7745c5c3_Var13 string |
| 184 | + | templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.MaxTitle)) |
| 185 | + | if templ_7745c5c3_Err != nil { |
| 186 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 33, Col: 131} |
| 187 | + | } |
| 188 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) |
| 189 | + | if templ_7745c5c3_Err != nil { |
| 190 | + | return templ_7745c5c3_Err |
| 191 | + | } |
| 192 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</output> ") |
| 193 | + | if templ_7745c5c3_Err != nil { |
| 194 | + | return templ_7745c5c3_Err |
| 195 | + | } |
| 196 | + | if p.ErrorField == "title" { |
| 197 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<p class=\"f-error\" role=\"alert\">") |
| 198 | + | if templ_7745c5c3_Err != nil { |
| 199 | + | return templ_7745c5c3_Err |
| 200 | + | } |
| 201 | + | var templ_7745c5c3_Var14 string |
| 202 | + | templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(p.Error) |
| 203 | + | if templ_7745c5c3_Err != nil { |
| 204 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 35, Col: 45} |
| 205 | + | } |
| 206 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) |
| 207 | + | if templ_7745c5c3_Err != nil { |
| 208 | + | return templ_7745c5c3_Err |
| 209 | + | } |
| 210 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</p>") |
| 211 | + | if templ_7745c5c3_Err != nil { |
| 212 | + | return templ_7745c5c3_Err |
| 213 | + | } |
| 214 | + | } |
| 215 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "<label for=\"issue-body\">description</label> <textarea id=\"issue-body\" name=\"body\" rows=\"8\" placeholder=\"Markdown, optional\">") |
| 216 | + | if templ_7745c5c3_Err != nil { |
| 217 | + | return templ_7745c5c3_Err |
| 218 | + | } |
| 219 | + | var templ_7745c5c3_Var15 string |
| 220 | + | templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(p.Body) |
| 221 | + | if templ_7745c5c3_Err != nil { |
| 222 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 38, Col: 91} |
| 223 | + | } |
| 224 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) |
| 225 | + | if templ_7745c5c3_Err != nil { |
| 226 | + | return templ_7745c5c3_Err |
| 227 | + | } |
| 228 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</textarea> <output data-for=\"issue-body\" data-max=\"") |
| 229 | + | if templ_7745c5c3_Err != nil { |
| 230 | + | return templ_7745c5c3_Err |
| 231 | + | } |
| 232 | + | var templ_7745c5c3_Var16 string |
| 233 | + | templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.ResolveAttributeValue(itoa(p.MaxBody)) |
| 234 | + | if templ_7745c5c3_Err != nil { |
| 235 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 39, Col: 59} |
| 236 | + | } |
| 237 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16) |
| 238 | + | if templ_7745c5c3_Err != nil { |
| 239 | + | return templ_7745c5c3_Err |
| 240 | + | } |
| 241 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "\" for=\"issue-body\">") |
| 242 | + | if templ_7745c5c3_Err != nil { |
| 243 | + | return templ_7745c5c3_Err |
| 244 | + | } |
| 245 | + | var templ_7745c5c3_Var17 string |
| 246 | + | templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(runeCount(p.Body))) |
| 247 | + | if templ_7745c5c3_Err != nil { |
| 248 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 39, Col: 104} |
| 249 | + | } |
| 250 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) |
| 251 | + | if templ_7745c5c3_Err != nil { |
| 252 | + | return templ_7745c5c3_Err |
| 253 | + | } |
| 254 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, " / ") |
| 255 | + | if templ_7745c5c3_Err != nil { |
| 256 | + | return templ_7745c5c3_Err |
| 257 | + | } |
| 258 | + | var templ_7745c5c3_Var18 string |
| 259 | + | templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.MaxBody)) |
| 260 | + | if templ_7745c5c3_Err != nil { |
| 261 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 39, Col: 126} |
| 262 | + | } |
| 263 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) |
| 264 | + | if templ_7745c5c3_Err != nil { |
| 265 | + | return templ_7745c5c3_Err |
| 266 | + | } |
| 267 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "</output> ") |
| 268 | + | if templ_7745c5c3_Err != nil { |
| 269 | + | return templ_7745c5c3_Err |
| 270 | + | } |
| 271 | + | if p.ErrorField == "body" { |
| 272 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<p class=\"f-error\" role=\"alert\">") |
| 273 | + | if templ_7745c5c3_Err != nil { |
| 274 | + | return templ_7745c5c3_Err |
| 275 | + | } |
| 276 | + | var templ_7745c5c3_Var19 string |
| 277 | + | templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(p.Error) |
| 278 | + | if templ_7745c5c3_Err != nil { |
| 279 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 41, Col: 45} |
| 280 | + | } |
| 281 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) |
| 282 | + | if templ_7745c5c3_Err != nil { |
| 283 | + | return templ_7745c5c3_Err |
| 284 | + | } |
| 285 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</p>") |
| 286 | + | if templ_7745c5c3_Err != nil { |
| 287 | + | return templ_7745c5c3_Err |
| 288 | + | } |
| 289 | + | } |
| 290 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<label for=\"issue-author\">name (optional, not verified)</label> <input id=\"issue-author\" name=\"author\" type=\"text\" autocomplete=\"off\" value=\"") |
| 291 | + | if templ_7745c5c3_Err != nil { |
| 292 | + | return templ_7745c5c3_Err |
| 293 | + | } |
| 294 | + | var templ_7745c5c3_Var20 string |
| 295 | + | templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.ResolveAttributeValue(p.Author) |
| 296 | + | if templ_7745c5c3_Err != nil { |
| 297 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 44, Col: 89} |
| 298 | + | } |
| 299 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20) |
| 300 | + | if templ_7745c5c3_Err != nil { |
| 301 | + | return templ_7745c5c3_Err |
| 302 | + | } |
| 303 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\"> <output data-for=\"issue-author\" data-max=\"") |
| 304 | + | if templ_7745c5c3_Err != nil { |
| 305 | + | return templ_7745c5c3_Err |
| 306 | + | } |
| 307 | + | var templ_7745c5c3_Var21 string |
| 308 | + | templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.ResolveAttributeValue(itoa(p.MaxAuthor)) |
| 309 | + | if templ_7745c5c3_Err != nil { |
| 310 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 45, Col: 63} |
| 311 | + | } |
| 312 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21) |
| 313 | + | if templ_7745c5c3_Err != nil { |
| 314 | + | return templ_7745c5c3_Err |
| 315 | + | } |
| 316 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\" for=\"issue-author\">") |
| 317 | + | if templ_7745c5c3_Err != nil { |
| 318 | + | return templ_7745c5c3_Err |
| 319 | + | } |
| 320 | + | var templ_7745c5c3_Var22 string |
| 321 | + | templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(runeCount(p.Author))) |
| 322 | + | if templ_7745c5c3_Err != nil { |
| 323 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 45, Col: 112} |
| 324 | + | } |
| 325 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) |
| 326 | + | if templ_7745c5c3_Err != nil { |
| 327 | + | return templ_7745c5c3_Err |
| 328 | + | } |
| 329 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, " / ") |
| 330 | + | if templ_7745c5c3_Err != nil { |
| 331 | + | return templ_7745c5c3_Err |
| 332 | + | } |
| 333 | + | var templ_7745c5c3_Var23 string |
| 334 | + | templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(itoa(p.MaxAuthor)) |
| 335 | + | if templ_7745c5c3_Err != nil { |
| 336 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 45, Col: 136} |
| 337 | + | } |
| 338 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) |
| 339 | + | if templ_7745c5c3_Err != nil { |
| 340 | + | return templ_7745c5c3_Err |
| 341 | + | } |
| 342 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</output> ") |
| 343 | + | if templ_7745c5c3_Err != nil { |
| 344 | + | return templ_7745c5c3_Err |
| 345 | + | } |
| 346 | + | if p.ErrorField == "author" { |
| 347 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<p class=\"f-error\" role=\"alert\">") |
| 348 | + | if templ_7745c5c3_Err != nil { |
| 349 | + | return templ_7745c5c3_Err |
| 350 | + | } |
| 351 | + | var templ_7745c5c3_Var24 string |
| 352 | + | templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(p.Error) |
| 353 | + | if templ_7745c5c3_Err != nil { |
| 354 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 47, Col: 45} |
| 355 | + | } |
| 356 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) |
| 357 | + | if templ_7745c5c3_Err != nil { |
| 358 | + | return templ_7745c5c3_Err |
| 359 | + | } |
| 360 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</p>") |
| 361 | + | if templ_7745c5c3_Err != nil { |
| 362 | + | return templ_7745c5c3_Err |
| 363 | + | } |
| 364 | + | } |
| 365 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<div class=\"hp\" aria-hidden=\"true\"><label for=\"issue-website\">Leave this field empty</label> <input id=\"issue-website\" name=\"website\" type=\"text\" tabindex=\"-1\" autocomplete=\"off\" value=\"\"></div><p class=\"dim\" data-status role=\"status\" aria-live=\"polite\">Checking your browser… (this takes a few seconds)</p><div class=\"f-btns\"><button type=\"submit\" class=\"btn primary\" disabled>Submit for moderation</button> <a class=\"btn\" href=\"") |
| 366 | + | if templ_7745c5c3_Err != nil { |
| 367 | + | return templ_7745c5c3_Err |
| 368 | + | } |
| 369 | + | var templ_7745c5c3_Var25 templ.SafeURL |
| 370 | + | templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(p.Cancel)) |
| 371 | + | if templ_7745c5c3_Err != nil { |
| 372 | + | return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/issues_form.templ`, Line: 56, Col: 49} |
| 373 | + | } |
| 374 | + | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) |
| 375 | + | if templ_7745c5c3_Err != nil { |
| 376 | + | return templ_7745c5c3_Err |
| 377 | + | } |
| 378 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "\">Cancel</a></div></form>") |
| 379 | + | if templ_7745c5c3_Err != nil { |
| 380 | + | return templ_7745c5c3_Err |
| 381 | + | } |
| 382 | + | return nil |
| 383 | + | }) |
| 384 | + | templ_7745c5c3_Err = Shell(l, issueFormRail()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) |
| 385 | + | if templ_7745c5c3_Err != nil { |
| 386 | + | return templ_7745c5c3_Err |
| 387 | + | } |
| 388 | + | return nil |
| 389 | + | }) |
| 390 | + | } |
| 391 | + | |
| 392 | + | func issueFormRail() templ.Component { |
| 393 | + | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 394 | + | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 395 | + | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 396 | + | return templ_7745c5c3_CtxErr |
| 397 | + | } |
| 398 | + | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 399 | + | if !templ_7745c5c3_IsBuffer { |
| 400 | + | defer func() { |
| 401 | + | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 402 | + | if templ_7745c5c3_Err == nil { |
| 403 | + | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 404 | + | } |
| 405 | + | }() |
| 406 | + | } |
| 407 | + | ctx = templ.InitializeContext(ctx) |
| 408 | + | templ_7745c5c3_Var26 := templ.GetChildren(ctx) |
| 409 | + | if templ_7745c5c3_Var26 == nil { |
| 410 | + | templ_7745c5c3_Var26 = templ.NopComponent |
| 411 | + | } |
| 412 | + | ctx = templ.ClearChildren(ctx) |
| 413 | + | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<section aria-labelledby=\"r-about\"><h2 id=\"r-about\">Before you write</h2><p class=\"dim\">The owner reads every issue before it appears. Plain text and Markdown only; no address of yours is kept.</p></section>") |
| 414 | + | if templ_7745c5c3_Err != nil { |
| 415 | + | return templ_7745c5c3_Err |
| 416 | + | } |
| 417 | + | return nil |
| 418 | + | }) |
| 419 | + | } |
| 420 | + | |
| 421 | + | var _ = templruntime.GeneratedTemplate |