view_content.tmpl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <div class="ui grid">
  2. {{if .Flash}}
  3. <div class="sixteen wide column">
  4. {{template "base/alert" .}}
  5. </div>
  6. {{end}}
  7. <div class="sixteen wide column title">
  8. <h1><span class="index">#{{.Issue.Index}}</span> {{.Issue.Name}}</h1>
  9. {{if .Issue.IsClosed}}
  10. <div class="ui red large label"><i class="octicon octicon-issue-closed"></i> {{.i18n.Tr "repo.issues.closed_title"}}</div>
  11. {{else}}
  12. <div class="ui green large label"><i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues.open_title"}}</div>
  13. {{end}}
  14. {{ $createdStr:= TimeSince .Issue.Created $.Lang }}
  15. <span class="time-desc">
  16. {{if gt .Issue.Poster.Id 0}}
  17. {{$.i18n.Tr "repo.issues.opened_by" $createdStr .Issue.Poster.Name | Safe}}
  18. {{else}}
  19. {{$.i18n.Tr "repo.issues.opened_by_fake" $createdStr .Issue.Poster.Name | Safe}}
  20. {{end}}
  21. ·
  22. {{$.i18n.Tr "repo.issues.num_comments" .Issue.NumComments}}
  23. </span>
  24. <div class="ui divider"></div>
  25. </div>
  26. <div class="twelve wide column comment-list">
  27. <ui class="ui comments">
  28. <div class="comment">
  29. <a class="avatar" {{if gt .Issue.Poster.Id 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
  30. <img src="{{.Issue.Poster.AvatarLink}}">
  31. </a>
  32. <div class="content">
  33. <div class="ui top attached header">
  34. <span class="text grey"><a {{if gt .Issue.Poster.Id 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.Name}}</a> {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}</span>
  35. <div class="ui right actions">
  36. </div>
  37. </div>
  38. <div class="ui attached segment markdown">
  39. {{if .Issue.RenderedContent}}
  40. {{.Issue.RenderedContent|Str2html}}
  41. {{else}}
  42. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  43. {{end}}
  44. </div>
  45. {{if .Issue.Attachments}}
  46. <div class="ui bottom attached segment">
  47. <div class="ui small images">
  48. {{range .Issue.Attachments}}
  49. <a target="_blank" href="/attachments/{{.UUID}}"><img class="ui image" src="/attachments/{{.UUID}}"></a>
  50. {{end}}
  51. </div>
  52. </div>
  53. {{end}}
  54. </div>
  55. </div>
  56. {{range .Issue.Comments}}
  57. {{ $createdStr:= TimeSince .Created $.Lang }}
  58. <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF -->
  59. {{if eq .Type 0}}
  60. <div class="comment">
  61. <a class="avatar" {{if gt .Poster.Id 0}}href="{{.Poster.HomeLink}}"{{end}}>
  62. <img src="{{.Poster.AvatarLink}}">
  63. </a>
  64. <div class="content">
  65. <div class="ui top attached header">
  66. <span class="text grey"><a {{if gt .Poster.Id 0}}href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}</span>
  67. <div class="ui right actions">
  68. {{if gt .ShowTag 0}}
  69. <div class="tag">
  70. {{if eq .ShowTag 1}}
  71. {{$.i18n.Tr "repo.issues.poster"}}
  72. {{else if eq .ShowTag 2}}
  73. {{$.i18n.Tr "repo.issues.admin"}}
  74. {{else if eq .ShowTag 3}}
  75. {{$.i18n.Tr "repo.issues.owner"}}
  76. {{end}}
  77. </div>
  78. {{end}}
  79. </div>
  80. </div>
  81. <div class="ui attached segment markdown">
  82. {{if .RenderedContent}}
  83. {{.RenderedContent|Str2html}}
  84. {{else}}
  85. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  86. {{end}}
  87. </div>
  88. {{if .Attachments}}
  89. <div class="ui bottom attached segment">
  90. <div class="ui small images">
  91. {{range .Attachments}}
  92. <a target="_blank" href="/attachments/{{.UUID}}"><img class="ui image" src="/attachments/{{.UUID}}"></a>
  93. {{end}}
  94. </div>
  95. </div>
  96. {{end}}
  97. </div>
  98. </div>
  99. {{else if eq .Type 1}}
  100. <div class="event">
  101. <span class="octicon octicon-primitive-dot"></span>
  102. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  103. <img src="{{.Poster.AvatarLink}}">
  104. </a>
  105. <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}}</span>
  106. </div>
  107. {{else if eq .Type 2}}
  108. <div class="event">
  109. <span class="octicon octicon-circle-slash"></span>
  110. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  111. <img src="{{.Poster.AvatarLink}}">
  112. </a>
  113. <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}</span>
  114. </div>
  115. {{end}}
  116. {{end}}
  117. {{if .IsSigned}}
  118. <div class="comment form">
  119. <a class="avatar" href="{{.SignedUser.HomeLink}}">
  120. <img src="{{.SignedUser.AvatarLink}}">
  121. </a>
  122. <div class="content">
  123. <form class="ui segment form" id="comment-form" action="{{.Link}}/comments" method="post">
  124. {{template "repo/issue/comment_tab" .}}
  125. {{.CsrfTokenHtml}}
  126. <input id="status" name="status" type="hidden">
  127. <div class="text right">
  128. {{if .IsIssueOwner}}
  129. {{if .Issue.IsClosed}}
  130. <div id="status-button" class="ui green basic button" data-status="{{.i18n.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
  131. {{.i18n.Tr "repo.issues.reopen_issue"}}
  132. </div>
  133. {{else}}
  134. <div id="status-button" class="ui red basic button" data-status="{{.i18n.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
  135. {{.i18n.Tr "repo.issues.close_issue"}}
  136. </div>
  137. {{end}}
  138. {{end}}
  139. <button class="ui green button">
  140. {{.i18n.Tr "repo.issues.create_comment"}}
  141. </button>
  142. </div>
  143. </form>
  144. </div>
  145. </div>
  146. {{else}}
  147. <div class="ui warning message">
  148. <a href="/user/sign_up" class="ui green button">{{.i18n.Tr "repo.issues.sign_up_for_free"}}</a>
  149. {{.i18n.Tr "repo.issues.sign_in_require_desc" "/user/login" | Safe}}
  150. </div>
  151. {{end}}
  152. </ui>
  153. </div>
  154. <div class="four wide column">
  155. <div class="ui segment metas">
  156. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} jump select-label dropdown">
  157. <span class="text">
  158. <strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
  159. <span class="octicon octicon-gear"></span>
  160. </span>
  161. <div class="filter menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/label">
  162. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
  163. {{range .Labels}}
  164. <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
  165. {{end}}
  166. </div>
  167. </div>
  168. <div class="ui labels list">
  169. <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
  170. {{range .Labels}}
  171. <a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name}}</span></a>
  172. {{end}}
  173. </div>
  174. <div class="ui divider"></div>
  175. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} jump select-milestone dropdown">
  176. <span class="text">
  177. <strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
  178. <span class="octicon octicon-gear"></span>
  179. </span>
  180. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/milestone">
  181. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
  182. {{if .OpenMilestones}}
  183. <div class="divider"></div>
  184. <div class="header">
  185. <i class="octicon octicon-milestone"></i>
  186. {{.i18n.Tr "repo.issues.new.open_milestone"}}
  187. </div>
  188. {{range .OpenMilestones}}
  189. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
  190. {{end}}
  191. {{end}}
  192. {{if .ClosedMilestones}}
  193. <div class="divider"></div>
  194. <div class="header">
  195. <i class="octicon octicon-milestone"></i>
  196. {{.i18n.Tr "repo.issues.new.closed_milestone"}}
  197. </div>
  198. {{range .ClosedMilestones}}
  199. <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
  200. {{end}}
  201. {{end}}
  202. </div>
  203. </div>
  204. <div class="ui select-milestone list">
  205. <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
  206. <div class="selected">
  207. {{if .Issue.Milestone}}
  208. <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
  209. {{end}}
  210. </div>
  211. </div>
  212. <div class="ui divider"></div>
  213. <input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
  214. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} jump select-assignee dropdown">
  215. <span class="text">
  216. <strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
  217. <span class="octicon octicon-gear"></span>
  218. </span>
  219. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/assignee">
  220. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_assignee"}}</div>
  221. {{range .Assignees}}
  222. <div class="item" data-id="{{.Id}}" data-href="{{$.RepoLink}}/issues?assignee={{.Id}}" data-avatar="{{.AvatarLink}}"><img src="{{.AvatarLink}}"> {{.Name}}</div>
  223. {{end}}
  224. </div>
  225. </div>
  226. <div class="ui select-assignee list">
  227. <span class="no-select item {{if .Issue.Assignee}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_assignee"}}</span>
  228. <div class="selected">
  229. {{if .Issue.Assignee}}
  230. <a class="item" href="{{$.RepoLink}}/issues?assignee={{.Issue.Assignee.Id}}"><img class="ui avatar image" src="{{.Issue.Assignee.AvatarLink}}"> {{.Issue.Assignee.Name}}</a>
  231. {{end}}
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. </div>