gitea源码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <div class="issue-content">
  2. {{$createdStr:= DateUtils.TimeSince .Issue.CreatedUnix}}
  3. <div class="issue-content-left comment-list prevent-before-timeline">
  4. <div class="ui timeline">
  5. <div id="{{.Issue.HashTag}}" class="timeline-item comment first">
  6. {{if .Issue.OriginalAuthor}}
  7. <span class="timeline-avatar">
  8. {{ctx.AvatarUtils.Avatar nil 40}}
  9. </span>
  10. {{else}}
  11. <a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
  12. {{ctx.AvatarUtils.Avatar .Issue.Poster 40}}
  13. </a>
  14. {{end}}
  15. <div class="content comment-container">
  16. <div class="comment-header avatar-content-left-arrow" role="heading" aria-level="3">
  17. <div class="comment-header-left">
  18. {{if .Issue.OriginalAuthor}}
  19. <span class="text black tw-font-semibold">
  20. {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}}
  21. {{.Issue.OriginalAuthor}}
  22. </span>
  23. <span class="text grey muted-links">
  24. {{ctx.Locale.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr}}
  25. </span>
  26. <span class="text migrate">
  27. {{if .Repository.OriginalURL}} ({{ctx.Locale.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname}}){{end}}
  28. </span>
  29. {{else}}
  30. <a class="inline-timeline-avatar" href="{{.Issue.Poster.HomeLink}}">
  31. {{ctx.AvatarUtils.Avatar .Issue.Poster 24}}
  32. </a>
  33. <span class="text grey muted-links">
  34. {{template "shared/user/authorlink" .Issue.Poster}}
  35. {{ctx.Locale.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr}}
  36. </span>
  37. {{end}}
  38. </div>
  39. <div class="comment-header-right">
  40. {{template "repo/issue/view_content/show_role" dict "ShowRole" .Issue.ShowRole "IgnorePoster" true}}
  41. {{if not $.Repository.IsArchived}}
  42. {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
  43. {{end}}
  44. {{template "repo/issue/view_content/context_menu" dict "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
  45. </div>
  46. </div>
  47. <div class="ui attached segment comment-body" role="article">
  48. <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}data-can-edit="true"{{end}}>
  49. {{if .Issue.RenderedContent}}
  50. {{.Issue.RenderedContent}}
  51. {{else}}
  52. <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
  53. {{end}}
  54. </div>
  55. <div id="issue-{{.Issue.ID}}-raw" class="raw-content tw-hidden">{{.Issue.Content}}</div>
  56. <div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-content-version="{{.Issue.ContentVersion}}" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
  57. {{if .Issue.Attachments}}
  58. {{template "repo/issue/view_content/attachments" dict "Attachments" .Issue.Attachments "RenderedContent" .Issue.RenderedContent}}
  59. {{end}}
  60. </div>
  61. {{$reactions := .Issue.Reactions.GroupByType}}
  62. {{if $reactions}}
  63. {{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
  64. {{end}}
  65. </div>
  66. </div>
  67. {{template "repo/issue/view_content/comments" .}}
  68. {{if and .Issue.IsPull (not $.Repository.IsArchived)}}
  69. {{template "repo/issue/view_content/pull_merge_box".}}
  70. {{end}}
  71. {{if .IsSigned}}
  72. {{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}}
  73. <div class="timeline-item comment form">
  74. <a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
  75. {{ctx.AvatarUtils.Avatar .SignedUser 40}}
  76. </a>
  77. <div class="content">
  78. <div class="ui segment avatar-content-left-arrow">
  79. <form class="ui form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
  80. {{template "repo/issue/comment_tab" .}}
  81. {{.CsrfTokenHtml}}
  82. <div class="field footer">
  83. <div class="flex-text-block tw-justify-end">
  84. {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
  85. {{if .Issue.IsClosed}}
  86. <button id="status-button" class="ui primary basic button" data-status="{{ctx.Locale.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.reopen_comment_issue"}}" name="status" value="reopen">
  87. {{ctx.Locale.Tr "repo.issues.reopen_issue"}}
  88. </button>
  89. {{else}}
  90. {{$closeTranslationKey := "repo.issues.close"}}
  91. {{if .Issue.IsPull}}
  92. {{$closeTranslationKey = "repo.pulls.close"}}
  93. {{end}}
  94. <button id="status-button" class="ui red basic button" data-status="{{ctx.Locale.Tr $closeTranslationKey}}" data-status-and-comment="{{ctx.Locale.Tr "repo.issues.close_comment_issue"}}" name="status" value="close">
  95. {{ctx.Locale.Tr $closeTranslationKey}}
  96. </button>
  97. {{end}}
  98. {{end}}
  99. <button id="comment-button" class="ui primary button">
  100. {{ctx.Locale.Tr "repo.issues.create_comment"}}
  101. </button>
  102. </div>
  103. </div>
  104. </form>
  105. </div>
  106. </div>
  107. </div>
  108. {{else if .Repository.IsArchived}}
  109. <div class="ui warning message tw-text-center">
  110. {{if .Issue.IsPull}}
  111. {{ctx.Locale.Tr "repo.archive.pull.nocomment"}}
  112. {{else}}
  113. {{ctx.Locale.Tr "repo.archive.issue.nocomment"}}
  114. {{end}}
  115. </div>
  116. {{end}}
  117. {{else}} {{/* not .IsSigned */}}
  118. {{if .Repository.IsArchived}}
  119. <div class="ui warning message tw-text-center">
  120. {{if .Issue.IsPull}}
  121. {{ctx.Locale.Tr "repo.archive.pull.nocomment"}}
  122. {{else}}
  123. {{ctx.Locale.Tr "repo.archive.issue.nocomment"}}
  124. {{end}}
  125. </div>
  126. {{else}}
  127. <div class="ui warning message">
  128. {{ctx.Locale.Tr "repo.issues.sign_in_require_desc" .SignInLink}}
  129. </div>
  130. {{end}}
  131. {{end}}{{/* end if: .IsSigned */}}
  132. </div>
  133. </div>
  134. {{template "repo/issue/view_content/sidebar" .}}
  135. </div>
  136. <template id="issue-comment-editor-template">
  137. <form class="ui form comment">
  138. <div class="field">
  139. {{template "shared/combomarkdowneditor" (dict
  140. "CustomInit" true
  141. "MarkdownPreviewInRepo" $.Repository
  142. "MarkdownPreviewMode" "comment"
  143. "TextareaName" "content"
  144. "DropzoneParentContainer" ".ui.form"
  145. )}}
  146. </div>
  147. {{if .IsAttachmentEnabled}}
  148. <div class="field">
  149. {{template "repo/upload" .}}
  150. </div>
  151. {{end}}
  152. <div class="field">
  153. <div class="flex-text-block tw-justify-end">
  154. <button type="button" class="ui cancel button">{{ctx.Locale.Tr "repo.issues.cancel"}}</button>
  155. <button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.save"}}</button>
  156. </div>
  157. </div>
  158. </form>
  159. </template>
  160. {{template "repo/issue/view_content/reference_issue_dialog" .}}
  161. {{template "shared/user/block_user_dialog" .}}
  162. <div class="ui g-modal-confirm delete modal">
  163. <div class="header">
  164. {{svg "octicon-trash"}}
  165. {{ctx.Locale.Tr "repo.branch.delete" .HeadTarget}}
  166. </div>
  167. <div class="content">
  168. <p>{{ctx.Locale.Tr "repo.branch.delete_desc"}}</p>
  169. </div>
  170. {{template "base/modal_actions_confirm" .}}
  171. </div>