Monorepo for Tangled
1{{ define "repo/issues/fragments/putIssue" }}
2<!-- this form is used for new and edit, .Issue is passed when editing -->
3<form
4 {{ if eq .Action "edit" }}
5 hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/edit"
6 {{ else }}
7 hx-post="/{{ .RepoInfo.FullName }}/issues/new"
8 {{ end }}
9 hx-swap="none"
10 hx-indicator="#spinner">
11 <div class="flex flex-col gap-2">
12 <div>
13 <label for="title">title</label>
14 <input type="text" name="title" id="title" class="w-full" value="{{ if .Issue }}{{ .Issue.Title }}{{ end }}" />
15 </div>
16 <div>
17 <label for="body">body</label>
18 <textarea
19 name="body"
20 id="body"
21 rows="15"
22 class="w-full resize-y"
23 placeholder="Describe your issue. Markdown is supported."
24 >{{ if .Issue }}{{ .Issue.Body }}{{ end }}</textarea>
25 </div>
26 <div class="flex justify-between">
27 <div id="issues" class="error"></div>
28 <div class="flex gap-2 items-center">
29 <a
30 class="btn flex items-center gap-2 no-underline hover:no-underline"
31 type="button"
32 {{ if .Issue }}
33 href="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}"
34 {{ else }}
35 href="/{{ .RepoInfo.FullName }}/issues"
36 {{ end }}
37 >
38 {{ i "x" "w-4 h-4" }}
39 cancel
40 </a>
41 <button type="submit" class="btn-create flex items-center gap-2">
42 {{ if eq .Action "edit" }}
43 {{ i "pencil" "w-4 h-4" }}
44 {{ .Action }} issue
45 {{ else }}
46 {{ i "circle-plus" "w-4 h-4" }}
47 {{ .Action }} issue
48 {{ end }}
49 <span id="spinner" class="group">
50 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }}
51 </span>
52 </button>
53 </div>
54 </div>
55 </div>
56</form>
57{{ end }}