gitea源码

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {{range .comments}}
  2. {{$createdStr:= DateUtils.TimeSince .CreatedUnix}}
  3. <div class="comment" id="{{.HashTag}}">
  4. <div class="tw-mt-2 tw-mr-4">
  5. {{if .OriginalAuthor}}
  6. <span class="avatar">{{ctx.AvatarUtils.Avatar nil}}</span>
  7. {{else}}
  8. {{template "shared/user/avatarlink" dict "user" .Poster}}
  9. {{end}}
  10. </div>
  11. <div class="content comment-container">
  12. <div class="comment-header avatar-content-left-arrow">
  13. <div class="comment-header-left">
  14. {{if .OriginalAuthor}}
  15. <span class="text black tw-font-semibold tw-mr-1">
  16. {{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}}
  17. {{.OriginalAuthor}}
  18. </span>
  19. <span class="text grey muted-links">
  20. {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}}
  21. </span>
  22. <span class="text migrate">
  23. {{if $.root.Repository.OriginalURL}}
  24. ({{ctx.Locale.Tr "repo.migrated_from" $.root.Repository.OriginalURL $.root.Repository.GetOriginalURLHostname}})
  25. {{end}}
  26. </span>
  27. {{else}}
  28. <span class="text grey muted-links">
  29. {{template "shared/user/namelink" .Poster}}
  30. {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}}
  31. </span>
  32. {{end}}
  33. </div>
  34. <div class="comment-header-right">
  35. {{if .Invalidated}}
  36. {{$referenceUrl := printf "%s#%s" $.root.Issue.Link .HashTag}}
  37. <a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
  38. {{ctx.Locale.Tr "repo.issues.review.outdated"}}
  39. </a>
  40. {{end}}
  41. {{if .Review}}
  42. {{if eq .Review.Type 0}}
  43. <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")}}">
  44. {{ctx.Locale.Tr "repo.issues.review.pending"}}
  45. </div>
  46. {{else}}
  47. <div class="ui label basic small">
  48. {{ctx.Locale.Tr "repo.issues.review.review"}}
  49. </div>
  50. {{end}}
  51. {{end}}
  52. {{if not $.root.Repository.IsArchived}}
  53. {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}}
  54. {{end}}
  55. {{template "repo/issue/view_content/context_menu" dict "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}
  56. </div>
  57. </div>
  58. <div class="ui attached segment comment-body">
  59. <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
  60. {{if .RenderedContent}}
  61. {{.RenderedContent}}
  62. {{else}}
  63. <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
  64. {{end}}
  65. </div>
  66. <div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
  67. <div class="edit-content-zone tw-hidden" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.root.RepoLink}}" data-attachment-url="{{$.root.RepoLink}}/comments/{{.ID}}/attachments"></div>
  68. {{if .Attachments}}
  69. {{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}}
  70. {{end}}
  71. </div>
  72. {{$reactions := .Reactions.GroupByType}}
  73. {{if $reactions}}
  74. {{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}}
  75. {{end}}
  76. </div>
  77. </div>
  78. {{end}}