You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

comments.tmpl 3.6KB

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