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

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