···
47
-
{{ if gt (len .Comments) 0 }}
48
-
<section id="comments" class="my-4 space-y-2 relative">
47
+
<section id="comments" class="my-2 mt-2 space-y-2 relative">
{{ range $index, $comment := .Comments }}
id="comment-{{ .CommentId }}"
···
{{ block "newComment" . }} {{ end }}
{{ define "newComment" }}
65
+
{{ if gt (len .Comments) 0 }}
66
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment"
hx-on::after-request="if(event.detail.successful) this.reset()"
<div class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-4 px-4 relative w-full md:w-3/5">
75
-
<div class="absolute left-8 -top-4 w-px h-4 bg-gray-300 dark:bg-gray-600"></div>
<div class="text-sm pb-2 text-gray-500 dark:text-gray-400">
{{ didOrHandle .LoggedInUser.Did .LoggedInUser.Handle }}
···
onkeyup="updateCommentForm()"
<div id="issue-comment"></div>
<div id="issue-action" class="error"></div>
···
{{ i "message-square-plus" "w-4 h-4" }}
{{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }}
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
{{ if and (or $isIssueAuthor $isRepoCollaborator) (eq .State "open") }}
···
hx-trigger="click from:#close-button"
hx-disabled-elt="#close-with-comment"
hx-target="#issue-comment"
122
-
hx-vals="js:{body: document.getElementById('comment-textarea').value.trim() !== '' ? document.getElementById('comment-textarea').value : null}">
120
+
hx-vals="js:{body: document.getElementById('comment-textarea').value.trim() !== '' ? document.getElementById('comment-textarea').value : ''}"
hx-disabled-elt="#close-issue"
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/close"
128
-
hx-trigger="click from:#close-button, revealed from:#close-with-comment"
128
+
hx-trigger="click from:#close-button"
hx-target="#issue-action"
134
+
document.addEventListener('htmx:configRequest', function(evt) {
135
+
if (evt.target.id === 'close-with-comment') {
136
+
const commentText = document.getElementById('comment-textarea').value.trim();
137
+
if (commentText === '') {
138
+
evt.detail.parameters = {};
139
+
evt.preventDefault();
{{ else if and (or $isIssueAuthor $isRepoCollaborator) (eq .State "closed") }}
···
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/reopen"
139
-
{{ i "circle-dot" "w-4 h-4" }}
151
+
{{ i "refresh-ccw-dot" "w-4 h-4" }}
function updateCommentForm() {
const textarea = document.getElementById('comment-textarea');
const commentButton = document.getElementById('comment-button');
const closeButton = document.getElementById('close-button');
if (textarea.value.trim() !== '') {
commentButton.removeAttribute('disabled');
commentButton.setAttribute('disabled', '');
if (textarea.value.trim() !== '') {
closeButton.innerHTML = '{{ i "ban" "w-4 h-4" }} close with comment';
···
document.addEventListener('DOMContentLoaded', function() {
···
172
-
<div class="bg-white dark:bg-gray-800 dark:text-gray-400 rounded drop-shadow-sm px-6 py-4 mt-8">
173
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
184
+
<div class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-4 px-4 relative w-fit">
<a href="/login" class="underline">login</a> to join the discussion