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

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