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.

view_content.tmpl 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <div class="ui stackable grid">
  2. {{if .Flash}}
  3. <div class="sixteen wide column">
  4. {{template "base/alert" .}}
  5. </div>
  6. {{end}}
  7. {{if not .Issue.IsPull}}
  8. {{template "repo/issue/view_title" .}}
  9. {{end}}
  10. {{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.Lang }}
  11. <div class="twelve wide column comment-list prevent-before-timeline">
  12. <ui class="ui timeline">
  13. <div id="{{.Issue.HashTag}}" class="timeline-item comment first">
  14. {{if .Issue.OriginalAuthor }}
  15. <span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
  16. {{else}}
  17. <a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
  18. {{avatar .Issue.Poster}}
  19. </a>
  20. {{end}}
  21. <div class="content comment-container">
  22. <div class="ui top attached header comment-header df ac sb">
  23. <div class="comment-header-left df ac">
  24. {{if .Issue.OriginalAuthor }}
  25. <span class="text black">
  26. {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}}
  27. {{ .Issue.OriginalAuthor }}
  28. </span>
  29. <span class="text grey">
  30. {{ .i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe }}
  31. </span>
  32. <span class="text migrate">
  33. {{if .Repository.OriginalURL}} ({{$.i18n.Tr "repo.migrated_from" .Repository.OriginalURL .Repository.GetOriginalURLHostname | Safe }}){{end}}
  34. </span>
  35. {{else}}
  36. <span class="text grey">
  37. <a class="author"{{if gt .Issue.Poster.ID 0}} href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.GetDisplayName}}</a>
  38. {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}
  39. </span>
  40. {{end}}
  41. </div>
  42. <div class="comment-header-right actions df ac">
  43. {{if not $.Repository.IsArchived}}
  44. {{if gt .Issue.ShowTag 0}}
  45. <div class="ui basic label">
  46. {{if eq .Issue.ShowTag 2}}
  47. {{$.i18n.Tr "repo.issues.collaborator"}}
  48. {{else if eq .Issue.ShowTag 3}}
  49. {{$.i18n.Tr "repo.issues.owner"}}
  50. {{end}}
  51. </div>
  52. {{end}}
  53. {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}}
  54. {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}}
  55. {{end}}
  56. </div>
  57. </div>
  58. <div class="ui attached segment comment-body">
  59. <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}data-can-edit="true"{{end}}>
  60. {{if .Issue.RenderedContent}}
  61. {{.Issue.RenderedContent|Str2html}}
  62. {{else}}
  63. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  64. {{end}}
  65. </div>
  66. <div id="comment-{{.Issue.ID}}" class="raw-content hide">{{.Issue.Content}}</div>
  67. <div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div>
  68. {{if .Issue.Attachments}}
  69. {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}}
  70. {{end}}
  71. </div>
  72. {{$reactions := .Issue.Reactions.GroupByType}}
  73. {{if $reactions}}
  74. <div class="ui attached segment reactions">
  75. {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions}}
  76. </div>
  77. {{end}}
  78. </div>
  79. </div>
  80. {{ template "repo/issue/view_content/comments" . }}
  81. {{if and .Issue.IsPull (not $.Repository.IsArchived)}}
  82. {{ template "repo/issue/view_content/pull". }}
  83. {{end}}
  84. {{if .IsSigned}}
  85. {{ if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived) }}
  86. <div class="timeline-item comment form">
  87. <a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
  88. {{avatar .SignedUser}}
  89. </a>
  90. <div class="content">
  91. <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
  92. {{template "repo/issue/comment_tab" .}}
  93. {{.CsrfTokenHtml}}
  94. <input id="status" name="status" type="hidden">
  95. <div class="field footer">
  96. <div class="text right">
  97. {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
  98. {{if .Issue.IsClosed}}
  99. <div id="status-button" class="ui green basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
  100. {{.i18n.Tr "repo.issues.reopen_issue"}}
  101. </div>
  102. {{else}}
  103. <div id="status-button" class="ui red basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
  104. {{.i18n.Tr "repo.issues.close_issue"}}
  105. </div>
  106. {{end}}
  107. {{end}}
  108. <button class="ui green button" tabindex="5">
  109. {{.i18n.Tr "repo.issues.create_comment"}}
  110. </button>
  111. </div>
  112. </div>
  113. </form>
  114. </div>
  115. </div>
  116. {{ else if .Repository.IsArchived }}
  117. <div class="ui warning message">
  118. {{if .Issue.IsPull}}
  119. {{.i18n.Tr "repo.archive.pull.nocomment"}}
  120. {{else}}
  121. {{.i18n.Tr "repo.archive.issue.nocomment"}}
  122. {{end}}
  123. </div>
  124. {{ end }}
  125. {{else}}
  126. {{if .Repository.IsArchived}}
  127. <div class="ui warning message">
  128. {{if .Issue.IsPull}}
  129. {{.i18n.Tr "repo.archive.pull.nocomment"}}
  130. {{else}}
  131. {{.i18n.Tr "repo.archive.issue.nocomment"}}
  132. {{end}}
  133. </div>
  134. {{else}}
  135. {{if .IsSigned}}
  136. {{if .Repository.IsArchived}}
  137. <div class="timeline-item comment form">
  138. <a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
  139. {{avatar .SignedUser}}
  140. </a>
  141. <div class="content">
  142. <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
  143. {{template "repo/issue/comment_tab" .}}
  144. {{.CsrfTokenHtml}}
  145. <input id="status" name="status" type="hidden">
  146. <div class="field footer">
  147. <div class="text right">
  148. {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .DisableStatusChange)}}
  149. {{if .Issue.IsClosed}}
  150. <div id="status-button" class="ui green basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
  151. {{.i18n.Tr "repo.issues.reopen_issue"}}
  152. </div>
  153. {{else}}
  154. <div id="status-button" class="ui red basic button" tabindex="6" data-status="{{.i18n.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
  155. {{.i18n.Tr "repo.issues.close_issue"}}
  156. </div>
  157. {{end}}
  158. {{end}}
  159. <button class="ui green button" tabindex="5">
  160. {{.i18n.Tr "repo.issues.create_comment"}}
  161. </button>
  162. </div>
  163. </div>
  164. </form>
  165. </div>
  166. </div>
  167. {{end}}
  168. {{else}}
  169. <div class="ui warning message">
  170. {{.i18n.Tr "repo.issues.sign_in_require_desc" .SignInLink | Safe}}
  171. </div>
  172. {{end}}
  173. {{end}}
  174. {{end}}
  175. </ui>
  176. </div>
  177. {{ template "repo/issue/view_content/sidebar" . }}
  178. </div>
  179. <div class="hide" id="edit-content-form">
  180. <div class="ui comment form">
  181. <div class="ui top tabular menu">
  182. <a class="active write item">{{$.i18n.Tr "write"}}</a>
  183. <a class="preview item" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
  184. </div>
  185. <div class="field">
  186. <div class="ui bottom active tab write">
  187. <textarea tabindex="1" name="content"></textarea>
  188. </div>
  189. <div class="ui bottom tab preview markup">
  190. {{$.i18n.Tr "loading"}}
  191. </div>
  192. </div>
  193. {{if .IsAttachmentEnabled}}
  194. <div class="field">
  195. {{template "repo/upload" .}}
  196. </div>
  197. {{end}}
  198. <div class="field footer">
  199. <div class="text right edit">
  200. <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div>
  201. <div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. {{template "repo/issue/view_content/reference_issue_dialog" .}}
  207. <div class="hide" id="no-content">
  208. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  209. </div>
  210. <div class="ui small basic delete modal">
  211. <div class="ui icon header">
  212. {{svg "octicon-trash"}}
  213. {{.i18n.Tr "repo.branch.delete" .HeadTarget }}
  214. </div>
  215. <div class="content">
  216. <p>{{.i18n.Tr "repo.branch.delete_desc" | Str2html}}</p>
  217. </div>
  218. {{template "base/delete_modal_actions" .}}
  219. </div>