Files
gitea/templates/repo/diff/comment_form.tmpl
T
wxiaoguang 222136ee71 refactor: clean up pull request comment related code and template dict (#39789)
1. drop comment.commit_id
2. refactor templates, remove `dict "." .` from templates
2026-10-15 23:09:41 +00:00

49 lines
2.4 KiB
Handlebars

{{$root := ctx.RootData -}}
{{$replyReviewComment := $.ReplyReviewComment -}}{{/* can be nil */ -}}
{{$canAddComment := and $root.SignedUserID (not $root.Repository.IsArchived) -}}
{{if $canAddComment}}
<form class="ui form {{if $replyReviewComment}}tw-hidden comment-form{{end}}" action="{{$root.Issue.Link}}/files/reviews/comments" method="post">
<input type="hidden" name="origin" value="{{if $root.PageIsPullFiles}}diff{{else}}timeline{{end}}">
<input type="hidden" name="latest_commit_id" value="{{$root.AfterCommitID}}">
<input type="hidden" name="side" value="{{$replyReviewComment.DiffSide}}">
<input type="hidden" name="line" value="{{$replyReviewComment.UnsignedLine}}">
<input type="hidden" name="path" value="{{$replyReviewComment.TreePath}}">
<input type="hidden" name="diff_start_cid">
<input type="hidden" name="diff_end_cid">
<input type="hidden" name="diff_base_cid">
<div class="field">
{{template "shared/combomarkdowneditor" (dict
"CustomInit" true
"MarkdownEditorContext" (ctx.MiscUtils.MarkdownEditorComment $root.Repository)
"TextareaName" "content"
"TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder")
"DropzoneParentContainer" "form"
"DisableAutosize" "true"
)}}
</div>
{{if $root.IsAttachmentEnabled}}
<div class="field">
{{template "repo/upload" dict "UploadOptions" $root.UploadOptions}}
</div>
{{end}}
<div class="field footer">
<div class="flex-text-block tw-justify-end">
{{if $replyReviewComment}}
<button class="ui submit primary tiny button" type="submit">{{ctx.Locale.Tr "repo.diff.comment.reply"}}</button>
<input type="hidden" name="reply" value="{{$replyReviewComment.ReviewID}}">
<input type="hidden" name="single_review" value="true">
{{else}}
{{if $root.CurrentReview}}
<button name="pending_review" type="submit" class="ui submit primary tiny button">{{ctx.Locale.Tr "repo.diff.comment.add_review_comment"}}</button>
{{else}}
<button name="pending_review" type="submit" class="ui submit primary tiny button">{{ctx.Locale.Tr "repo.diff.comment.start_review"}}</button>
<button name="single_review" value="true" type="submit" class="ui submit tiny basic button">{{ctx.Locale.Tr "repo.diff.comment.add_single_comment"}}</button>
{{end}}
{{end}}
<button type="button" class="ui submit tiny basic button" data-global-click="onCancelCodeComment">{{ctx.Locale.Tr "cancel"}}</button>
</div>
</div>
</form>
{{end}}