view_content.tmpl 16 KB

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