view_content.tmpl 14 KB

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