view_content.tmpl 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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.AvatarLink}}">
  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.AvatarLink}}">
  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.AvatarLink}}">
  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.AvatarLink}}">
  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.AvatarLink}}">
  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.AvatarLink}}">
  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. <a href="{{AppSubUrl}}/user/sign_up" class="ui green button">{{.i18n.Tr "repo.issues.sign_up_for_free"}}</a>
  224. {{.i18n.Tr "repo.issues.sign_in_require_desc" .SignInLink | Safe}}
  225. </div>
  226. {{end}}
  227. </ui>
  228. </div>
  229. <div class="four wide column">
  230. <div class="ui segment metas">
  231. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-label dropdown">
  232. <span class="text">
  233. <strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
  234. <span class="octicon octicon-gear"></span>
  235. </span>
  236. <div class="filter menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/label">
  237. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
  238. {{range .Labels}}
  239. <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>
  240. {{end}}
  241. </div>
  242. </div>
  243. <div class="ui labels list">
  244. <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
  245. {{range .Labels}}
  246. <div class="item">
  247. <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>
  248. </div>
  249. {{end}}
  250. </div>
  251. <div class="ui divider"></div>
  252. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-milestone dropdown">
  253. <span class="text">
  254. <strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
  255. <span class="octicon octicon-gear"></span>
  256. </span>
  257. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/milestone">
  258. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
  259. {{if .OpenMilestones}}
  260. <div class="divider"></div>
  261. <div class="header">
  262. <i class="octicon octicon-milestone"></i>
  263. {{.i18n.Tr "repo.issues.new.open_milestone"}}
  264. </div>
  265. {{range .OpenMilestones}}
  266. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
  267. {{end}}
  268. {{end}}
  269. {{if .ClosedMilestones}}
  270. <div class="divider"></div>
  271. <div class="header">
  272. <i class="octicon octicon-milestone"></i>
  273. {{.i18n.Tr "repo.issues.new.closed_milestone"}}
  274. </div>
  275. {{range .ClosedMilestones}}
  276. <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
  277. {{end}}
  278. {{end}}
  279. </div>
  280. </div>
  281. <div class="ui select-milestone list">
  282. <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
  283. <div class="selected">
  284. {{if .Issue.Milestone}}
  285. <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
  286. {{end}}
  287. </div>
  288. </div>
  289. <div class="ui divider"></div>
  290. <input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
  291. <div class="ui {{if not .IsRepositoryWriter}}disabled{{end}} floating jump select-assignee dropdown">
  292. <span class="text">
  293. <strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
  294. <span class="octicon octicon-gear"></span>
  295. </span>
  296. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/assignee">
  297. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_assignee"}}</div>
  298. {{range .Assignees}}
  299. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?assignee={{.ID}}" data-avatar="{{.AvatarLink}}"><img src="{{.AvatarLink}}"> {{.Name}}</div>
  300. {{end}}
  301. </div>
  302. </div>
  303. <div class="ui select-assignee list">
  304. <span class="no-select item {{if .Issue.Assignee}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_assignee"}}</span>
  305. <div class="selected">
  306. {{if .Issue.Assignee}}
  307. <a class="item" href="{{$.RepoLink}}/issues?assignee={{.Issue.Assignee.ID}}"><img class="ui avatar image" src="{{.Issue.Assignee.AvatarLink}}"> {{.Issue.Assignee.Name}}</a>
  308. {{end}}
  309. </div>
  310. </div>
  311. <div class="ui divider"></div>
  312. <div class="ui participants">
  313. <span class="text"><strong>{{.i18n.Tr "repo.issues.num_participants" .NumParticipants}}</strong></span>
  314. <div>
  315. {{range .Participants}}
  316. <a href="{{.HomeLink}}">
  317. <img class="ui avatar image poping up" src="{{.AvatarLink}}" data-content="{{.DisplayName}}" data-position="top center" data-variation="small inverted">
  318. </a>
  319. {{end}}
  320. </div>
  321. </div>
  322. </div>
  323. </div>
  324. </div>
  325. <div class="hide" id="edit-content-form">
  326. <div class="ui comment form">
  327. <div class="ui top attached tabular menu">
  328. <a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a>
  329. <a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a>
  330. </div>
  331. <div class="ui bottom attached active write tab segment">
  332. <textarea tabindex="1" id="content" name="content"></textarea>
  333. </div>
  334. <div class="ui bottom attached tab preview segment markdown">
  335. {{$.i18n.Tr "repo.release.loading"}}
  336. </div>
  337. <div class="text right edit buttons">
  338. <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div>
  339. <div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div>
  340. </div>
  341. </div>
  342. </div>
  343. <div class="hide" id="no-content">
  344. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  345. </div>