Monorepo for Tangled
1{{ define "repo/issues/fragments/issueCommentActions" }}
2 {{ $isCommentOwner := and .LoggedInUser (eq .LoggedInUser.Did .Comment.Did) }}
3 {{ if and $isCommentOwner (not .Comment.Deleted) }}
4 <div class="flex flex-wrap items-center gap-4 text-gray-500 dark:text-gray-400 text-sm pt-2">
5 {{ template "edit" . }}
6 {{ template "delete" . }}
7 </div>
8 {{ end }}
9{{ end }}
10
11{{ define "edit" }}
12 <a
13 class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer"
14 hx-get="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment/{{ .Comment.Id }}/edit"
15 hx-swap="outerHTML"
16 hx-target="#comment-body-{{.Comment.Id}}">
17 {{ i "pencil" "size-3" }}
18 edit
19 </a>
20{{ end }}
21
22{{ define "delete" }}
23 <a
24 class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer"
25 hx-delete="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment/{{ .Comment.Id }}/"
26 hx-confirm="Are you sure you want to delete your comment?"
27 hx-swap="outerHTML"
28 hx-target="#comment-body-{{.Comment.Id}}"
29 >
30 {{ i "trash-2" "size-3" }}
31 delete
32 {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }}
33 </a>
34{{ end }}