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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. <a class="avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
  15. <img src="{{.Issue.Poster.RelAvatarLink}}">
  16. </a>
  17. <div class="content">
  18. <div class="ui top attached header">
  19. <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>
  20. {{if not $.Repository.IsArchived}}
  21. <div class="ui right actions">
  22. {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) }}
  23. {{if or .IsIssueWriter .IsIssuePoster}}
  24. <div class="item action">
  25. <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
  26. </div>
  27. {{end}}
  28. </div>
  29. {{end}}
  30. </div>
  31. <div class="ui attached segment">
  32. <div class="render-content markdown has-emoji">
  33. {{if .Issue.RenderedContent}}
  34. {{.Issue.RenderedContent|Str2html}}
  35. {{else}}
  36. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  37. {{end}}
  38. </div>
  39. <div class="raw-content hide">{{.Issue.Content}}</div>
  40. <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}}"></div>
  41. </div>
  42. {{$reactions := .Issue.Reactions.GroupByType}}
  43. {{if $reactions}}
  44. <div class="ui attached segment reactions">
  45. {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index) "Reactions" $reactions }}
  46. </div>
  47. {{end}}
  48. {{if .Issue.Attachments}}
  49. <div class="ui bottom attached segment">
  50. <div class="ui small images">
  51. {{range .Issue.Attachments}}
  52. <a target="_blank" rel="noopener noreferrer" href="{{AppSubUrl}}/attachments/{{.UUID}}">
  53. {{if FilenameIsImage .Name}}
  54. <img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
  55. {{else}}
  56. <span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span>
  57. {{end}}
  58. </a>
  59. {{end}}
  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. {{ end }}
  100. {{else}}
  101. {{if .Repository.IsArchived}}
  102. <div class="ui warning message">
  103. {{if .Issue.IsPull}}
  104. {{.i18n.Tr "repo.archive.pull.nocomment"}}
  105. {{else}}
  106. {{.i18n.Tr "repo.archive.issue.nocomment"}}
  107. {{end}}
  108. </div>
  109. {{else}}
  110. {{if .IsSigned}}
  111. {{if .Repository.IsArchived}}
  112. <div class="comment form">
  113. <a class="avatar" href="{{.SignedUser.HomeLink}}">
  114. <img src="{{.SignedUser.RelAvatarLink}}">
  115. </a>
  116. <div class="content">
  117. <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
  118. {{template "repo/issue/comment_tab" .}}
  119. {{.CsrfTokenHtml}}
  120. <input id="status" name="status" type="hidden">
  121. <div class="text right">
  122. {{if and (or .IsIssueWriter .IsIssuePoster) (not .DisableStatusChange)}}
  123. {{if .Issue.IsClosed}}
  124. <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">
  125. {{.i18n.Tr "repo.issues.reopen_issue"}}
  126. </div>
  127. {{else}}
  128. <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">
  129. {{.i18n.Tr "repo.issues.close_issue"}}
  130. </div>
  131. {{end}}
  132. {{end}}
  133. <button class="ui green button" tabindex="5">
  134. {{.i18n.Tr "repo.issues.create_comment"}}
  135. </button>
  136. </div>
  137. </form>
  138. </div>
  139. </div>
  140. {{end}}
  141. {{else}}
  142. <div class="ui warning message">
  143. {{.i18n.Tr "repo.issues.sign_in_require_desc" .SignInLink | Safe}}
  144. </div>
  145. {{end}}
  146. {{end}}
  147. {{end}}
  148. </ui>
  149. </div>
  150. {{ template "repo/issue/view_content/sidebar" . }}
  151. </div>
  152. <div class="hide" id="edit-content-form">
  153. <div class="ui comment form">
  154. <div class="ui top attached tabular menu">
  155. <a class="active write item">{{$.i18n.Tr "write"}}</a>
  156. <a class="preview item" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
  157. </div>
  158. <div class="ui bottom attached active write tab segment">
  159. <textarea tabindex="1" name="content"></textarea>
  160. </div>
  161. <div class="ui bottom attached tab preview segment markdown">
  162. {{$.i18n.Tr "loading"}}
  163. </div>
  164. <div class="text right edit buttons">
  165. <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div>
  166. <div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="hide" id="no-content">
  171. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  172. </div>
  173. <div class="ui small basic delete modal">
  174. <div class="ui icon header">
  175. <i class="trash icon"></i>
  176. {{.i18n.Tr "repo.branch.delete" .HeadTarget }}
  177. </div>
  178. <div class="content">
  179. <p>{{.i18n.Tr "repo.branch.delete_desc" | Str2html}}</p>
  180. </div>
  181. {{template "base/delete_modal_actions" .}}
  182. </div>