gitea/templates/repo/conversation/comment_form.tmpl
2024-10-25 22:05:56 +08:00

68 lines
3.6 KiB
Handlebars

<!-- The comment form usually at the bottom of comments. -->
<!-- If the user has not signed in, it shows a box to suggest sign in instead -->
{{if .IsSigned}}
{{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not (and .IsIssue .Issue.IsLocked))) (not .Repository.IsArchived)}}
<div class="timeline-item comment form">
<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
{{ctx.AvatarUtils.Avatar .SignedUser 40}}
</a>
<div class="content">
<div class="ui segment">
{{if .IsIssue}}
<form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
{{else}}
<form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/conversations/{{.Conversation.Index}}/comments" method="post">
{{end}}
{{template "repo/conversation/comment_tab" .}}
{{.CsrfTokenHtml}}
<div class="field footer">
<div class="text right">
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
{{if and .IsIssue .Issue.IsClosed}}
<button id="status-button" class="ui primary basic button" data-status="{{ctx.Locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.reopen_comment_issue"}}" name="status" value="reopen">
{{ctx.Locale.Tr "repo.issues.reopen_issue"}}
</button>
{{else}}
{{$closeTranslationKey := "repo.issues.close"}}
{{if and .IsIssue .Issue.IsPull}}
{{$closeTranslationKey = "repo.pulls.close"}}
{{end}}
<button id="status-button" class="ui red basic button" data-status="{{ctx.Locale.Tr $closeTranslationKey}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.close_comment_issue"}}" name="status" value="close">
{{ctx.Locale.Tr $closeTranslationKey}}
</button>
{{end}}
{{end}}
<button id="comment-button" class="ui primary button">
{{ctx.Locale.Tr "repo.issues.create_comment"}}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
{{else if .Repository.IsArchived}}
<div class="ui warning message tw-text-center">
{{if and .IsIssue .Issue.IsPull}}
{{ctx.Locale.Tr "repo.archive.pull.nocomment"}}
{{else}}
{{ctx.Locale.Tr "repo.archive.issue.nocomment"}}
{{end}}
</div>
{{end}}
{{else}} {{/* not .IsSigned */}}
{{if .Repository.IsArchived}}
<div class="ui warning message tw-text-center">
{{if .IsIssue and .Issue.IsPull}}
{{ctx.Locale.Tr "repo.archive.pull.nocomment"}}
{{else}}
{{ctx.Locale.Tr "repo.archive.issue.nocomment"}}
{{end}}
</div>
{{else}}
<div class="ui warning message">
{{ctx.Locale.Tr "repo.issues.sign_in_require_desc" .SignInLink}}
</div>
{{end}}
{{end}}{{/* end if: .IsSigned */}}