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

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