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.

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