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