view_content.tmpl 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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 {{if .Issue.HasMerged}}purple{{else if .Issue.IsClosed}}grey{{else if and .Issue.CanAutoMerge (not .IsPullReuqestBroken)}}green{{else}}red{{end}}">
  131. <span class="mega-octicon octicon-git-merge"></span>
  132. </a>
  133. <div class="content">
  134. <div class="ui merge segment">
  135. {{if .Issue.HasMerged}}
  136. <div class="item text purple">
  137. {{$.i18n.Tr "repo.pulls.has_merged"}}
  138. </div>
  139. {{else if .Issue.IsClosed}}
  140. <div class="item text grey">
  141. {{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
  142. </div>
  143. {{else if .IsPullReuqestBroken}}
  144. <div class="item text red">
  145. <span class="octicon octicon-x"></span>
  146. {{$.i18n.Tr "repo.pulls.data_broken"}}
  147. </div>
  148. {{else if .Issue.CanAutoMerge}}
  149. <div class="item text green">
  150. <span class="octicon octicon-check"></span>
  151. {{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
  152. </div>
  153. {{if .IsRepositoryAdmin}}
  154. <div class="ui divider"></div>
  155. <div>
  156. <form class="ui form" action="{{.Link}}/merge" method="post">
  157. {{.CsrfTokenHtml}}
  158. <button class="ui green button">
  159. <span class="octicon octicon-git-merge"></span> {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
  160. </button>
  161. </form>
  162. </div>
  163. {{end}}
  164. {{else}}
  165. <div class="item text red">
  166. <span class="octicon octicon-x"></span>
  167. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
  168. </div>
  169. <div class="item text grey">
  170. <span class="octicon octicon-info"></span>
  171. {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
  172. </div>
  173. {{end}}
  174. </div>
  175. </div>
  176. </div>
  177. {{end}}
  178. {{if .IsSigned}}
  179. <div class="comment form">
  180. <a class="avatar" href="{{.SignedUser.HomeLink}}">
  181. <img src="{{.SignedUser.AvatarLink}}">
  182. </a>
  183. <div class="content">
  184. <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
  185. {{template "repo/issue/comment_tab" .}}
  186. {{.CsrfTokenHtml}}
  187. <input id="status" name="status" type="hidden">
  188. <div class="text right">
  189. {{if and .IsIssueOwner (not .DisableStatusChange)}}
  190. {{if .Issue.IsClosed}}
  191. <div id="status-button" class="ui green basic button" data-status="{{.i18n.Tr "repo.issues.reopen_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.reopen_comment_issue"}}" data-status-val="reopen">
  192. {{.i18n.Tr "repo.issues.reopen_issue"}}
  193. </div>
  194. {{else}}
  195. <div id="status-button" class="ui red basic button" data-status="{{.i18n.Tr "repo.issues.close_issue"}}" data-status-and-comment="{{.i18n.Tr "repo.issues.close_comment_issue"}}" data-status-val="close">
  196. {{.i18n.Tr "repo.issues.close_issue"}}
  197. </div>
  198. {{end}}
  199. {{end}}
  200. <button class="ui green button">
  201. {{.i18n.Tr "repo.issues.create_comment"}}
  202. </button>
  203. </div>
  204. </form>
  205. </div>
  206. </div>
  207. {{else}}
  208. <div class="ui warning message">
  209. <a href="{{AppSubUrl}}/user/sign_up" class="ui green button">{{.i18n.Tr "repo.issues.sign_up_for_free"}}</a>
  210. {{.i18n.Tr "repo.issues.sign_in_require_desc" .SignInLink | Safe}}
  211. </div>
  212. {{end}}
  213. </ui>
  214. </div>
  215. <div class="four wide column">
  216. <div class="ui segment metas">
  217. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} floating jump select-label dropdown">
  218. <span class="text">
  219. <strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
  220. <span class="octicon octicon-gear"></span>
  221. </span>
  222. <div class="filter menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/label">
  223. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
  224. {{range .Labels}}
  225. <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>
  226. {{end}}
  227. </div>
  228. </div>
  229. <div class="ui labels list">
  230. <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
  231. {{range .Labels}}
  232. <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>
  233. {{end}}
  234. </div>
  235. <div class="ui divider"></div>
  236. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} floating jump select-milestone dropdown">
  237. <span class="text">
  238. <strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
  239. <span class="octicon octicon-gear"></span>
  240. </span>
  241. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/milestone">
  242. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
  243. {{if .OpenMilestones}}
  244. <div class="divider"></div>
  245. <div class="header">
  246. <i class="octicon octicon-milestone"></i>
  247. {{.i18n.Tr "repo.issues.new.open_milestone"}}
  248. </div>
  249. {{range .OpenMilestones}}
  250. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
  251. {{end}}
  252. {{end}}
  253. {{if .ClosedMilestones}}
  254. <div class="divider"></div>
  255. <div class="header">
  256. <i class="octicon octicon-milestone"></i>
  257. {{.i18n.Tr "repo.issues.new.closed_milestone"}}
  258. </div>
  259. {{range .ClosedMilestones}}
  260. <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
  261. {{end}}
  262. {{end}}
  263. </div>
  264. </div>
  265. <div class="ui select-milestone list">
  266. <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
  267. <div class="selected">
  268. {{if .Issue.Milestone}}
  269. <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
  270. {{end}}
  271. </div>
  272. </div>
  273. <div class="ui divider"></div>
  274. <input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
  275. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} floating jump select-assignee dropdown">
  276. <span class="text">
  277. <strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
  278. <span class="octicon octicon-gear"></span>
  279. </span>
  280. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/assignee">
  281. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_assignee"}}</div>
  282. {{range .Assignees}}
  283. <div class="item" data-id="{{.Id}}" data-href="{{$.RepoLink}}/issues?assignee={{.Id}}" data-avatar="{{.AvatarLink}}"><img src="{{.AvatarLink}}"> {{.Name}}</div>
  284. {{end}}
  285. </div>
  286. </div>
  287. <div class="ui select-assignee list">
  288. <span class="no-select item {{if .Issue.Assignee}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_assignee"}}</span>
  289. <div class="selected">
  290. {{if .Issue.Assignee}}
  291. <a class="item" href="{{$.RepoLink}}/issues?assignee={{.Issue.Assignee.Id}}"><img class="ui avatar image" src="{{.Issue.Assignee.AvatarLink}}"> {{.Issue.Assignee.Name}}</a>
  292. {{end}}
  293. </div>
  294. </div>
  295. </div>
  296. </div>
  297. </div>
  298. <div class="hide" id="edit-content-form">
  299. <div class="ui comment form">
  300. <div class="ui top attached tabular menu">
  301. <a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a>
  302. <a class="preview item" data-url="/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a>
  303. </div>
  304. <div class="ui bottom attached active write tab segment">
  305. <textarea id="content" name="content"></textarea>
  306. </div>
  307. <div class="ui bottom attached tab preview segment markdown emojify">
  308. {{$.i18n.Tr "repo.release.loading"}}
  309. </div>
  310. <div class="text right edit buttons">
  311. <div class="ui basic blue cancel button">{{.i18n.Tr "repo.issues.cancel"}}</div>
  312. <div class="ui green save button">{{.i18n.Tr "repo.issues.save"}}</div>
  313. </div>
  314. </div>
  315. </div>
  316. <div class="hide" id="no-content">
  317. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  318. </div>