view_content.tmpl 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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.DisplayName}}</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.DisplayName}}</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 $.LoggedUserID)}}
  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.DisplayName}}</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. {{if .IsPullBranchDeletable}}
  161. <div class="ui divider"></div>
  162. <div>
  163. <form class="ui form" action="{{.DeleteBranchLink}}" method="post">
  164. {{.CSRFTokenHTML}}
  165. <button class="ui red button">{{$.i18n.Tr "repo.pulls.delete_branch"}}</button>
  166. </form>
  167. </div>
  168. {{end}}
  169. {{else if .Issue.IsClosed}}
  170. <div class="item text grey">
  171. {{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
  172. </div>
  173. {{else if .IsPullReuqestBroken}}
  174. <div class="item text red">
  175. <span class="octicon octicon-x"></span>
  176. {{$.i18n.Tr "repo.pulls.data_broken"}}
  177. </div>
  178. {{else if .Issue.PullRequest.IsChecking}}
  179. <div class="item text yellow">
  180. <span class="octicon octicon-sync"></span>
  181. {{$.i18n.Tr "repo.pulls.is_checking"}}
  182. </div>
  183. {{else if .Issue.PullRequest.CanAutoMerge}}
  184. <div class="item text green">
  185. <span class="octicon octicon-check"></span>
  186. {{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
  187. </div>
  188. {{if .IsRepositoryWriter}}
  189. <div class="ui divider"></div>
  190. <form class="ui form" action="{{.Link}}/merge" method="post">
  191. {{.CSRFTokenHTML}}
  192. <div class="field">
  193. <div class="ui radio checkbox">
  194. <input type="radio" name="merge_style" value="create_merge_commit" checked="checked">
  195. <label>{{$.i18n.Tr "repo.pulls.create_merge_commit"}}</label>
  196. </div>
  197. </div>
  198. {{if .Issue.Repo.PullsAllowRebase}}
  199. <div class="field">
  200. <div class="ui radio checkbox">
  201. <input type="radio" name="merge_style" value="rebase_before_merging">
  202. <label>{{$.i18n.Tr "repo.pulls.rebase_before_merging"}}</label>
  203. </div>
  204. </div>
  205. {{end}}
  206. <button class="ui green button">
  207. <span class="octicon octicon-git-merge"></span> {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
  208. </button>
  209. </form>
  210. {{end}}
  211. {{else}}
  212. <div class="item text red">
  213. <span class="octicon octicon-x"></span>
  214. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
  215. </div>
  216. <div class="item text grey">
  217. <span class="octicon octicon-info"></span>
  218. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
  219. </div>
  220. {{end}}
  221. </div>
  222. </div>
  223. </div>
  224. {{end}}
  225. {{if .IsLogged}}
  226. <div class="comment form">
  227. <a class="avatar" href="{{.LoggedUser.HomeLink}}">
  228. <img src="{{.LoggedUser.RelAvatarLink}}">
  229. </a>
  230. <div class="content">
  231. <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
  232. {{template "repo/issue/comment_tab" .}}
  233. {{.CSRFTokenHTML}}
  234. <input id="status" name="status" type="hidden">
  235. <div class="text right">
  236. {{if and .IsIssueOwner (not .DisableStatusChange)}}
  237. {{if .Issue.IsClosed}}
  238. <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">
  239. {{.i18n.Tr "repo.issues.reopen_issue"}}
  240. </div>
  241. {{else}}
  242. <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">
  243. {{.i18n.Tr "repo.issues.close_issue"}}
  244. </div>
  245. {{end}}
  246. {{end}}
  247. <button class="ui green button" tabindex="5">
  248. {{.i18n.Tr "repo.issues.create_comment"}}
  249. </button>
  250. </div>
  251. </form>
  252. </div>
  253. </div>
  254. {{else}}
  255. <div class="ui warning message">
  256. {{.i18n.Tr "repo.issues.sign_in_require_desc" .SignInLink | Safe}}
  257. </div>
  258. {{end}}
  259. </ui>
  260. </div>
  261. <div class="four wide column">
  262. <div class="ui segment metas">
  263. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-label dropdown">
  264. <span class="text">
  265. <strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
  266. <span class="octicon octicon-gear"></span>
  267. </span>
  268. <div class="filter menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/label">
  269. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
  270. {{range .Labels}}
  271. <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>
  272. {{end}}
  273. </div>
  274. </div>
  275. <div class="ui labels list">
  276. <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
  277. {{range .Labels}}
  278. <div class="item">
  279. <a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name | Sanitize}}</a>
  280. </div>
  281. {{end}}
  282. </div>
  283. <div class="ui divider"></div>
  284. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-milestone dropdown">
  285. <span class="text">
  286. <strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
  287. <span class="octicon octicon-gear"></span>
  288. </span>
  289. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/milestone">
  290. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
  291. {{if .OpenMilestones}}
  292. <div class="divider"></div>
  293. <div class="header">
  294. <i class="octicon octicon-milestone"></i>
  295. {{.i18n.Tr "repo.issues.new.open_milestone"}}
  296. </div>
  297. {{range .OpenMilestones}}
  298. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name | Sanitize}}</div>
  299. {{end}}
  300. {{end}}
  301. {{if .ClosedMilestones}}
  302. <div class="divider"></div>
  303. <div class="header">
  304. <i class="octicon octicon-milestone"></i>
  305. {{.i18n.Tr "repo.issues.new.closed_milestone"}}
  306. </div>
  307. {{range .ClosedMilestones}}
  308. <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name | Sanitize}}</a>
  309. {{end}}
  310. {{end}}
  311. </div>
  312. </div>
  313. <div class="ui select-milestone list">
  314. <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
  315. <div class="selected">
  316. {{if .Issue.Milestone}}
  317. <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name | Sanitize}}</a>
  318. {{end}}
  319. </div>
  320. </div>
  321. <div class="ui divider"></div>
  322. <input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
  323. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-assignee dropdown">
  324. <span class="text">
  325. <strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
  326. <span class="octicon octicon-gear"></span>
  327. </span>
  328. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/assignee">
  329. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_assignee"}}</div>
  330. {{range .Assignees}}
  331. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?assignee={{.ID}}" data-avatar="{{.RelAvatarLink}}"><img src="{{.RelAvatarLink}}"> {{.DisplayName}}</div>
  332. {{end}}
  333. </div>
  334. </div>
  335. <div class="ui select-assignee list">
  336. <span class="no-select item {{if .Issue.Assignee}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_assignee"}}</span>
  337. <div class="selected">
  338. {{if .Issue.Assignee}}
  339. <a class="item" href="{{$.RepoLink}}/issues?assignee={{.Issue.Assignee.ID}}"><img class="ui avatar image" src="{{.Issue.Assignee.RelAvatarLink}}"> {{.Issue.Assignee.DisplayName}}</a>
  340. {{end}}
  341. </div>
  342. </div>
  343. <div class="ui divider"></div>
  344. <div class="ui participants">
  345. <span class="text"><strong>{{.i18n.Tr "repo.issues.num_participants" .NumParticipants}}</strong></span>
  346. <div>
  347. {{range .Participants}}
  348. <a href="{{.HomeLink}}">
  349. <img class="ui avatar image poping up" src="{{.RelAvatarLink}}" data-content="{{.DisplayName}}" data-position="top center" data-variation="small inverted">
  350. </a>
  351. {{end}}
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. <div class="hide" id="edit-content-form">
  358. <div class="ui comment form">
  359. <div class="ui top attached tabular menu">
  360. <a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a>
  361. <a class="preview item" data-url="{{AppSubURL}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a>
  362. </div>
  363. <div class="ui bottom attached active write tab segment">
  364. <textarea tabindex="1" id="content" name="content"></textarea>
  365. </div>
  366. <div class="ui bottom attached tab preview segment markdown">
  367. {{$.i18n.Tr "repo.release.loading"}}
  368. </div>
  369. <div class="text right edit buttons">
  370. <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div>
  371. <div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div>
  372. </div>
  373. </div>
  374. </div>
  375. <div class="hide" id="no-content">
  376. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  377. </div>