mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-26 06:16:56 +09:00
1. drop comment.commit_id 2. refactor templates, remove `dict "." .` from templates
86 lines
3.9 KiB
Handlebars
86 lines
3.9 KiB
Handlebars
{{$root := ctx.RootData -}}
|
|
{{$repo := $root.Repository -}}
|
|
{{$repoLink := $root.RepoLink -}}
|
|
{{$issue := $root.Issue -}}
|
|
{{$canWrite := or $root.Permission.IsAdmin $root.HasIssuesOrPullsWritePermission -}}
|
|
{{$signedUserID := or $root.SignedUserID NIL -}}
|
|
{{range $comment := $.comments}}
|
|
{{$createdStr:= DateUtils.TimeSince $comment.CreatedUnix}}
|
|
<div class="comment" id="{{$comment.HashTag}}">
|
|
<div class="tw-mt-2 tw-mr-4">
|
|
{{if $comment.OriginalAuthor}}
|
|
<span class="avatar">{{ctx.AvatarUtils.Avatar nil}}</span>
|
|
{{else}}
|
|
{{template "shared/user/avatarlink" dict "user" $comment.Poster}}
|
|
{{end}}
|
|
</div>
|
|
<div class="content comment-container">
|
|
<div class="comment-header avatar-content-left-arrow">
|
|
<div class="comment-header-left">
|
|
{{if $comment.OriginalAuthor}}
|
|
<span class="tw-text-text tw-font-semibold tw-mr-1">
|
|
{{svg (MigrationIcon $repo.GetOriginalURLHostname)}}
|
|
{{$comment.OriginalAuthor}}
|
|
</span>
|
|
<span class="tw-text-text-light muted-links">
|
|
{{ctx.Locale.Tr "repo.issues.commented_at" $comment.HashTag $createdStr}}
|
|
</span>
|
|
<span class="text migrate">
|
|
{{if $repo.OriginalURL}}
|
|
({{ctx.Locale.Tr "repo.migrated_from" $repo.OriginalURL $repo.GetOriginalURLHostname}})
|
|
{{end}}
|
|
</span>
|
|
{{else}}
|
|
<span class="tw-text-text-light muted-links">
|
|
{{template "shared/user/namelink" $comment.Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.commented_at" $comment.HashTag $createdStr}}
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
<div class="comment-header-right">
|
|
{{if $comment.Invalidated}}
|
|
{{$referenceUrl := printf "%s#%s" $issue.Link $comment.HashTag}}
|
|
<a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
|
|
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
|
|
</a>
|
|
{{end}}
|
|
{{if $comment.Review}}
|
|
{{if eq $comment.Review.Type 0}}
|
|
<div class="ui label basic small yellow pending-label" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.pending.tooltip" (ctx.Locale.Tr "repo.diff.review") (ctx.Locale.Tr "repo.diff.review.approve") (ctx.Locale.Tr "repo.diff.review.comment") (ctx.Locale.Tr "repo.diff.review.reject")}}">
|
|
{{ctx.Locale.Tr "repo.issues.review.pending"}}
|
|
</div>
|
|
{{else}}
|
|
<div class="ui label basic small">
|
|
{{ctx.Locale.Tr "repo.issues.review.review"}}
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if not $repo.IsArchived}}
|
|
{{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $repoLink $comment.ID)}}
|
|
{{end}}
|
|
{{template "repo/issue/view_content/context_menu" dict "ConvContentType" "issue_comment" "ConvContentPage" "pr-files" "ConvContentItem" $comment}}
|
|
</div>
|
|
</div>
|
|
<div class="ui attached segment comment-body">
|
|
{{$doerIsPoster := eq $signedUserID $comment.PosterID}}
|
|
<div class="render-content markup" {{if or $canWrite $doerIsPoster}}data-can-edit="true"{{end}}>
|
|
{{if $comment.RenderedContent}}
|
|
{{$comment.RenderedContent}}
|
|
{{else}}
|
|
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
|
|
{{end}}
|
|
</div>
|
|
<div id="{{$comment.HashTag}}-raw" class="raw-content tw-hidden">{{$comment.Content}}</div>
|
|
<div class="edit-content-zone tw-hidden" data-update-url="{{$repoLink}}/comments/{{$comment.ID}}" data-content-version="{{$comment.ContentVersion}}" data-context="{{$repoLink}}" data-attachment-url="{{$repoLink}}/comments/{{$comment.ID}}/attachments"></div>
|
|
{{if $comment.Attachments}}
|
|
{{template "repo/issue/view_content/attachments" dict "Attachments" $comment.Attachments "RenderedContent" $comment.RenderedContent}}
|
|
{{end}}
|
|
</div>
|
|
{{$reactions := $comment.Reactions.GroupByType}}
|
|
{{if $reactions}}
|
|
{{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $repoLink $comment.ID) "Reactions" $reactions}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|