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.

373 lines
15 KiB

  1. <div class="ui 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:= TimeSince .Issue.Created $.Lang }}
  11. <div class="twelve wide column comment-list">
  12. <ui class="ui comments">
  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.Name}}</a> {{.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}}</span>
  20. <div class="ui right actions">
  21. {{if .IsIssueOwner}}
  22. <div class="item action">
  23. <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
  24. </div>
  25. {{end}}
  26. </div>
  27. </div>
  28. <div class="ui attached segment">
  29. <div class="render-content markdown has-emoji">
  30. {{if .Issue.RenderedContent}}
  31. {{.Issue.RenderedContent|Str2html}}
  32. {{else}}
  33. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  34. {{end}}
  35. </div>
  36. <div class="raw-content hide">{{.Issue.Content}}</div>
  37. <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>
  38. </div>
  39. {{if .Issue.Attachments}}
  40. <div class="ui bottom attached segment">
  41. <div class="ui small images">
  42. {{range .Issue.Attachments}}
  43. <a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}">
  44. {{if FilenameIsImage .Name}}
  45. <img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
  46. {{else}}
  47. <span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span>
  48. {{end}}
  49. </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" id="{{.HashTag}}">
  61. <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
  62. <img src="{{.Poster.RelAvatarLink}}">
  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="item tag">
  70. {{if eq .ShowTag 1}}
  71. {{$.i18n.Tr "repo.issues.poster"}}
  72. {{else if eq .ShowTag 2}}
  73. {{$.i18n.Tr "repo.issues.collaborator"}}
  74. {{else if eq .ShowTag 3}}
  75. {{$.i18n.Tr "repo.issues.owner"}}
  76. {{end}}
  77. </div>
  78. {{end}}
  79. {{if or $.IsRepositoryAdmin (eq .Poster.ID $.SignedUserID)}}
  80. <div class="item action">
  81. <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a>
  82. <a class="delete-comment" href="#" data-comment-id={{.HashTag}} data-url="{{$.RepoLink}}/comments/{{.ID}}/delete" data-locale="{{$.i18n.Tr "repo.issues.delete_comment_confirm"}}"><i class="octicon octicon-x"></i></a>
  83. </div>
  84. {{end}}
  85. </div>
  86. </div>
  87. <div class="ui attached segment">
  88. <div class="render-content markdown has-emoji">
  89. {{if .RenderedContent}}
  90. {{.RenderedContent|Str2html}}
  91. {{else}}
  92. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  93. {{end}}
  94. </div>
  95. <div class="raw-content hide">{{.Content}}</div>
  96. <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}"></div>
  97. </div>
  98. {{if .Attachments}}
  99. <div class="ui bottom attached segment">
  100. <div class="ui small images">
  101. {{range .Attachments}}
  102. <a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}">
  103. {{if FilenameIsImage .Name}}
  104. <img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
  105. {{else}}
  106. <span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span>
  107. {{end}}
  108. </a>
  109. {{end}}
  110. </div>
  111. </div>
  112. {{end}}
  113. </div>
  114. </div>
  115. {{else if eq .Type 1}}
  116. <div class="event">
  117. <span class="octicon octicon-primitive-dot"></span>
  118. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  119. <img src="{{.Poster.RelAvatarLink}}">
  120. </a>
  121. <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}}</span>
  122. </div>
  123. {{else if eq .Type 2}}
  124. <div class="event">
  125. <span class="octicon octicon-circle-slash"></span>
  126. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  127. <img src="{{.Poster.RelAvatarLink}}">
  128. </a>
  129. <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}</span>
  130. </div>
  131. {{else if eq .Type 4}}
  132. <div class="event">
  133. <span class="octicon octicon-bookmark"></span>
  134. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  135. <img src="{{.Poster.RelAvatarLink}}">
  136. </a>
  137. <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}}</span>
  138. <div class="detail">
  139. <span class="octicon octicon-git-commit"></span>
  140. <span class="text grey">{{.Content | Str2html}}</span>
  141. </div>
  142. </div>
  143. {{end}}
  144. {{end}}
  145. {{if .Issue.IsPull}}
  146. <div class="comment merge box">
  147. <a class="avatar text
  148. {{if .Issue.PullRequest.HasMerged}}purple
  149. {{else if .Issue.IsClosed}}grey
  150. {{else if .IsPullReuqestBroken}}red
  151. {{else if .Issue.PullRequest.IsChecking}}yellow
  152. {{else if .Issue.PullRequest.CanAutoMerge}}green
  153. {{else}}red{{end}}"><span class="mega-octicon octicon-git-merge"></span></a>
  154. <div class="content">
  155. <div class="ui merge segment">
  156. {{if .Issue.PullRequest.HasMerged}}
  157. <div class="item text purple">
  158. {{$.i18n.Tr "repo.pulls.has_merged"}}
  159. </div>
  160. {{else if .Issue.IsClosed}}
  161. <div class="item text grey">
  162. {{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
  163. </div>
  164. {{else if .IsPullReuqestBroken}}
  165. <div class="item text red">
  166. <span class="octicon octicon-x"></span>
  167. {{$.i18n.Tr "repo.pulls.data_broken"}}
  168. </div>
  169. {{else if .Issue.PullRequest.IsChecking}}
  170. <div class="item text yellow">
  171. <span class="octicon octicon-sync"></span>
  172. {{$.i18n.Tr "repo.pulls.is_checking"}}
  173. </div>
  174. {{else if .Issue.PullRequest.CanAutoMerge}}
  175. <div class="item text green">
  176. <span class="octicon octicon-check"></span>
  177. {{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
  178. </div>
  179. {{if .IsRepositoryWriter}}
  180. <div class="ui divider"></div>
  181. <div>
  182. <form class="ui form" action="{{.Link}}/merge" method="post">
  183. {{.CsrfTokenHtml}}
  184. <button class="ui green button">
  185. <span class="octicon octicon-git-merge"></span> {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
  186. </button>
  187. </form>
  188. </div>
  189. {{end}}
  190. {{else}}
  191. <div class="item text red">
  192. <span class="octicon octicon-x"></span>
  193. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
  194. </div>
  195. <div class="item text grey">
  196. <span class="octicon octicon-info"></span>
  197. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
  198. </div>
  199. {{end}}
  200. </div>
  201. </div>
  202. </div>
  203. {{end}}
  204. {{if .IsSigned}}
  205. <div class="comment form">
  206. <a class="avatar" href="{{.SignedUser.HomeLink}}">
  207. <img src="{{.SignedUser.RelAvatarLink}}">
  208. </a>
  209. <div class="content">
  210. <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
  211. {{template "repo/issue/comment_tab" .}}
  212. {{.CsrfTokenHtml}}
  213. <input id="status" name="status" type="hidden">
  214. <div class="text right">
  215. {{if and .IsIssueOwner (not .DisableStatusChange)}}
  216. {{if .Issue.IsClosed}}
  217. <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">
  218. {{.i18n.Tr "repo.issues.reopen_issue"}}
  219. </div>
  220. {{else}}
  221. <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">
  222. {{.i18n.Tr "repo.issues.close_issue"}}
  223. </div>
  224. {{end}}
  225. {{end}}
  226. <button class="ui green button" tabindex="5">
  227. {{.i18n.Tr "repo.issues.create_comment"}}
  228. </button>
  229. </div>
  230. </form>
  231. </div>
  232. </div>
  233. {{else}}
  234. <div class="ui warning message">
  235. {{.i18n.Tr "repo.issues.sign_in_require_desc" .SignInLink | Safe}}
  236. </div>
  237. {{end}}
  238. </ui>
  239. </div>
  240. <div class="four wide column">
  241. <div class="ui segment metas">
  242. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-label dropdown">
  243. <span class="text">
  244. <strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
  245. <span class="octicon octicon-gear"></span>
  246. </span>
  247. <div class="filter menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/label">
  248. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
  249. {{range .Labels}}
  250. <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>
  251. {{end}}
  252. </div>
  253. </div>
  254. <div class="ui labels list">
  255. <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
  256. {{range .Labels}}
  257. <div class="item">
  258. <a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>
  259. </div>
  260. {{end}}
  261. </div>
  262. <div class="ui divider"></div>
  263. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-milestone dropdown">
  264. <span class="text">
  265. <strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
  266. <span class="octicon octicon-gear"></span>
  267. </span>
  268. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/milestone">
  269. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
  270. {{if .OpenMilestones}}
  271. <div class="divider"></div>
  272. <div class="header">
  273. <i class="octicon octicon-milestone"></i>
  274. {{.i18n.Tr "repo.issues.new.open_milestone"}}
  275. </div>
  276. {{range .OpenMilestones}}
  277. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
  278. {{end}}
  279. {{end}}
  280. {{if .ClosedMilestones}}
  281. <div class="divider"></div>
  282. <div class="header">
  283. <i class="octicon octicon-milestone"></i>
  284. {{.i18n.Tr "repo.issues.new.closed_milestone"}}
  285. </div>
  286. {{range .ClosedMilestones}}
  287. <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
  288. {{end}}
  289. {{end}}
  290. </div>
  291. </div>
  292. <div class="ui select-milestone list">
  293. <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
  294. <div class="selected">
  295. {{if .Issue.Milestone}}
  296. <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
  297. {{end}}
  298. </div>
  299. </div>
  300. <div class="ui divider"></div>
  301. <input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
  302. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-assignee dropdown">
  303. <span class="text">
  304. <strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
  305. <span class="octicon octicon-gear"></span>
  306. </span>
  307. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/assignee">
  308. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_assignee"}}</div>
  309. {{range .Assignees}}
  310. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?assignee={{.ID}}" data-avatar="{{.RelAvatarLink}}"><img src="{{.RelAvatarLink}}"> {{.Name}}</div>
  311. {{end}}
  312. </div>
  313. </div>
  314. <div class="ui select-assignee list">
  315. <span class="no-select item {{if .Issue.Assignee}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_assignee"}}</span>
  316. <div class="selected">
  317. {{if .Issue.Assignee}}
  318. <a class="item" href="{{$.RepoLink}}/issues?assignee={{.Issue.Assignee.ID}}"><img class="ui avatar image" src="{{.Issue.Assignee.RelAvatarLink}}"> {{.Issue.Assignee.Name}}</a>
  319. {{end}}
  320. </div>
  321. </div>
  322. <div class="ui divider"></div>
  323. <div class="ui participants">
  324. <span class="text"><strong>{{.i18n.Tr "repo.issues.num_participants" .NumParticipants}}</strong></span>
  325. <div>
  326. {{range .Participants}}
  327. <a href="{{.HomeLink}}">
  328. <img class="ui avatar image poping up" src="{{.RelAvatarLink}}" data-content="{{.DisplayName}}" data-position="top center" data-variation="small inverted">
  329. </a>
  330. {{end}}
  331. </div>
  332. </div>
  333. </div>
  334. </div>
  335. </div>
  336. <div class="hide" id="edit-content-form">
  337. <div class="ui comment form">
  338. <div class="ui top attached tabular menu">
  339. <a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a>
  340. <a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a>
  341. </div>
  342. <div class="ui bottom attached active write tab segment">
  343. <textarea tabindex="1" id="content" name="content"></textarea>
  344. </div>
  345. <div class="ui bottom attached tab preview segment markdown">
  346. {{$.i18n.Tr "repo.release.loading"}}
  347. </div>
  348. <div class="text right edit buttons">
  349. <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div>
  350. <div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div>
  351. </div>
  352. </div>
  353. </div>
  354. <div class="hide" id="no-content">
  355. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  356. </div>