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 10.0KB

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