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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {{range .comments}}
  2. {{ $createdStr:= TimeSinceUnix .CreatedUnix $.root.Lang }}
  3. <div class="comment" id="{{.HashTag}}">
  4. {{if .OriginalAuthor }}
  5. <span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
  6. {{else}}
  7. <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
  8. {{avatar .Poster}}
  9. </a>
  10. {{end}}
  11. <div class="content comment-container">
  12. <div class="ui top attached header comment-header df ac sb">
  13. <div class="comment-header-left df ac">
  14. {{if .OriginalAuthor }}
  15. <span class="text black mr-2">
  16. {{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}}
  17. {{ .OriginalAuthor }}
  18. </span>
  19. <span class="text grey">
  20. {{$.root.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}
  21. </span>
  22. <span class="text migrate">
  23. {{if $.root.Repository.OriginalURL}}
  24. ({{$.root.i18n.Tr "repo.migrated_from" $.root.Repository.OriginalURL $.root.Repository.GetOriginalURLHostname | Safe }})
  25. {{end}}
  26. </span>
  27. {{else}}
  28. <span class="text grey">
  29. <a {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
  30. {{.Poster.GetDisplayName}}
  31. </a>
  32. {{$.root.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}
  33. </span>
  34. {{end}}
  35. </div>
  36. <div class="comment-header-right actions df ac">
  37. {{if and .Review}}
  38. {{if eq .Review.Type 0}}
  39. <div class="ui label basic small yellow">
  40. {{$.root.i18n.Tr "repo.issues.review.pending"}}
  41. </div>
  42. {{else}}
  43. <div class="ui label basic small">
  44. {{$.root.i18n.Tr "repo.issues.review.review"}}
  45. </div>
  46. {{end}}
  47. {{end}}
  48. {{template "repo/issue/view_content/add_reaction" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) }}
  49. {{template "repo/issue/view_content/context_menu" Dict "ctx" $.root "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}
  50. </div>
  51. </div>
  52. <div class="ui attached segment comment-body">
  53. <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
  54. {{if .RenderedContent}}
  55. {{.RenderedContent|Str2html}}
  56. {{else}}
  57. <span class="no-content">{{$.root.i18n.Tr "repo.issues.no_content"}}</span>
  58. {{end}}
  59. </div>
  60. <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
  61. <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}"></div>
  62. </div>
  63. {{$reactions := .Reactions.GroupByType}}
  64. {{if $reactions}}
  65. <div class="ui attached segment reactions">
  66. {{template "repo/issue/view_content/reactions" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}}
  67. </div>
  68. {{end}}
  69. </div>
  70. </div>
  71. {{end}}