view_content.tmpl 17 KB

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