view_content.tmpl 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <div class="ui grid">
  2. {{if .Flash}}
  3. <div class="sixteen wide column">
  4. {{template "base/alert" .}}
  5. </div>
  6. {{end}}
  7. <div class="sixteen wide column title">
  8. <div class="ui grid">
  9. <h1 class="twelve wide column">
  10. <span class="index">#{{.Issue.Index}}</span> <span id="issue-title">{{.Issue.Name}}</span>
  11. <div id="edit-title-input" class="ui input" style="display: none">
  12. <input value="{{.Issue.Name}}">
  13. </div>
  14. </h1>
  15. {{if .IsIssueOwner}}
  16. <div class="four wide column">
  17. <div class="edit-zone text right">
  18. <div id="edit-title" class="ui basic green not-in-edit button">{{.i18n.Tr "repo.issues.edit"}}</div>
  19. <div id="cancel-edit-title" class="ui basic blue in-edit button" style="display: none">{{.i18n.Tr "repo.issues.cancel"}}</div>
  20. <div id="save-edit-title" class="ui green in-edit button" style="display: none" data-update-url="{{.Link}}/title">{{.i18n.Tr "repo.issues.save"}}</div>
  21. </div>
  22. </div>
  23. {{end}}
  24. </div>
  25. {{if .Issue.IsClosed}}
  26. <div class="ui red large label"><i class="octicon octicon-issue-closed"></i> {{.i18n.Tr "repo.issues.closed_title"}}</div>
  27. {{else}}
  28. <div class="ui green large label"><i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues.open_title"}}</div>
  29. {{end}}
  30. {{ $createdStr:= TimeSince .Issue.Created $.Lang }}
  31. <span class="time-desc">
  32. {{if gt .Issue.Poster.Id 0}}
  33. {{$.i18n.Tr "repo.issues.opened_by" $createdStr .Issue.Poster.Name | Safe}}
  34. {{else}}
  35. {{$.i18n.Tr "repo.issues.opened_by_fake" $createdStr .Issue.Poster.Name | Safe}}
  36. {{end}}
  37. ·
  38. {{$.i18n.Tr "repo.issues.num_comments" .Issue.NumComments}}
  39. </span>
  40. <div class="ui divider"></div>
  41. </div>
  42. <div class="twelve wide column comment-list">
  43. <ui class="ui comments">
  44. <div class="comment">
  45. <a class="avatar" {{if gt .Issue.Poster.Id 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
  46. <img src="{{.Issue.Poster.AvatarLink}}">
  47. </a>
  48. <div class="content">
  49. <div class="ui top attached header">
  50. <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>
  51. <div class="ui right actions">
  52. {{if .IsIssueOwner}}
  53. <a class="edit-content item" href="#"><i class="octicon octicon-pencil"></i></a>
  54. {{end}}
  55. </div>
  56. </div>
  57. <div class="ui attached segment">
  58. <div class="render-content markdown">
  59. {{if .Issue.RenderedContent}}
  60. {{.Issue.RenderedContent|Str2html}}
  61. {{else}}
  62. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  63. {{end}}
  64. </div>
  65. <div class="raw-content hide">{{.Issue.Content}}</div>
  66. <div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{.Link}}/content" data-context="{{.RepoLink}}"></div>
  67. </div>
  68. {{if .Issue.Attachments}}
  69. <div class="ui bottom attached segment">
  70. <div class="ui small images">
  71. {{range .Issue.Attachments}}
  72. <a target="_blank" href="/attachments/{{.UUID}}"><img class="ui image" src="/attachments/{{.UUID}}"></a>
  73. {{end}}
  74. </div>
  75. </div>
  76. {{end}}
  77. </div>
  78. </div>
  79. {{range .Issue.Comments}}
  80. {{ $createdStr:= TimeSince .Created $.Lang }}
  81. <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF -->
  82. {{if eq .Type 0}}
  83. <div class="comment">
  84. <a class="avatar" {{if gt .Poster.Id 0}}href="{{.Poster.HomeLink}}"{{end}}>
  85. <img src="{{.Poster.AvatarLink}}">
  86. </a>
  87. <div class="content">
  88. <div class="ui top attached header">
  89. <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>
  90. <div class="ui right actions">
  91. {{if gt .ShowTag 0}}
  92. <div class="item tag">
  93. {{if eq .ShowTag 1}}
  94. {{$.i18n.Tr "repo.issues.poster"}}
  95. {{else if eq .ShowTag 2}}
  96. {{$.i18n.Tr "repo.issues.admin"}}
  97. {{else if eq .ShowTag 3}}
  98. {{$.i18n.Tr "repo.issues.owner"}}
  99. {{end}}
  100. </div>
  101. {{end}}
  102. {{if or $.IsRepositoryAdmin (eq .Poster.Id $.SignedUserID)}}
  103. <a class="edit-content item" href="#"><i class="octicon octicon-pencil"></i></a>
  104. {{end}}
  105. </div>
  106. </div>
  107. <div class="ui attached segment">
  108. <div class="render-content markdown">
  109. {{if .RenderedContent}}
  110. {{.RenderedContent|Str2html}}
  111. {{else}}
  112. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  113. {{end}}
  114. </div>
  115. <div class="raw-content hide">{{.Content}}</div>
  116. <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>
  117. </div>
  118. {{if .Attachments}}
  119. <div class="ui bottom attached segment">
  120. <div class="ui small images">
  121. {{range .Attachments}}
  122. <a target="_blank" href="/attachments/{{.UUID}}"><img class="ui image" src="/attachments/{{.UUID}}"></a>
  123. {{end}}
  124. </div>
  125. </div>
  126. {{end}}
  127. </div>
  128. </div>
  129. {{else if eq .Type 1}}
  130. <div class="event">
  131. <span class="octicon octicon-primitive-dot"></span>
  132. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  133. <img src="{{.Poster.AvatarLink}}">
  134. </a>
  135. <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}}</span>
  136. </div>
  137. {{else if eq .Type 2}}
  138. <div class="event">
  139. <span class="octicon octicon-circle-slash"></span>
  140. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  141. <img src="{{.Poster.AvatarLink}}">
  142. </a>
  143. <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}</span>
  144. </div>
  145. {{end}}
  146. {{end}}
  147. {{if .IsSigned}}
  148. <div class="comment form">
  149. <a class="avatar" href="{{.SignedUser.HomeLink}}">
  150. <img src="{{.SignedUser.AvatarLink}}">
  151. </a>
  152. <div class="content">
  153. <form class="ui segment form" id="comment-form" action="{{.Link}}/comments" method="post">
  154. {{template "repo/issue/comment_tab" .}}
  155. {{.CsrfTokenHtml}}
  156. <input id="status" name="status" type="hidden">
  157. <div class="text right">
  158. {{if .IsIssueOwner}}
  159. {{if .Issue.IsClosed}}
  160. <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">
  161. {{.i18n.Tr "repo.issues.reopen_issue"}}
  162. </div>
  163. {{else}}
  164. <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">
  165. {{.i18n.Tr "repo.issues.close_issue"}}
  166. </div>
  167. {{end}}
  168. {{end}}
  169. <button class="ui green button">
  170. {{.i18n.Tr "repo.issues.create_comment"}}
  171. </button>
  172. </div>
  173. </form>
  174. </div>
  175. </div>
  176. {{else}}
  177. <div class="ui warning message">
  178. <a href="/user/sign_up" class="ui green button">{{.i18n.Tr "repo.issues.sign_up_for_free"}}</a>
  179. {{.i18n.Tr "repo.issues.sign_in_require_desc" "/user/login" | Safe}}
  180. </div>
  181. {{end}}
  182. </ui>
  183. </div>
  184. <div class="four wide column">
  185. <div class="ui segment metas">
  186. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} jump select-label dropdown">
  187. <span class="text">
  188. <strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
  189. <span class="octicon octicon-gear"></span>
  190. </span>
  191. <div class="filter menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/label">
  192. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
  193. {{range .Labels}}
  194. <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>
  195. {{end}}
  196. </div>
  197. </div>
  198. <div class="ui labels list">
  199. <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_label"}}</span>
  200. {{range .Labels}}
  201. <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>
  202. {{end}}
  203. </div>
  204. <div class="ui divider"></div>
  205. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} jump select-milestone dropdown">
  206. <span class="text">
  207. <strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
  208. <span class="octicon octicon-gear"></span>
  209. </span>
  210. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/milestone">
  211. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
  212. {{if .OpenMilestones}}
  213. <div class="divider"></div>
  214. <div class="header">
  215. <i class="octicon octicon-milestone"></i>
  216. {{.i18n.Tr "repo.issues.new.open_milestone"}}
  217. </div>
  218. {{range .OpenMilestones}}
  219. <div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
  220. {{end}}
  221. {{end}}
  222. {{if .ClosedMilestones}}
  223. <div class="divider"></div>
  224. <div class="header">
  225. <i class="octicon octicon-milestone"></i>
  226. {{.i18n.Tr "repo.issues.new.closed_milestone"}}
  227. </div>
  228. {{range .ClosedMilestones}}
  229. <a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
  230. {{end}}
  231. {{end}}
  232. </div>
  233. </div>
  234. <div class="ui select-milestone list">
  235. <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
  236. <div class="selected">
  237. {{if .Issue.Milestone}}
  238. <a class="item" href="{{.RepoLink}}/issues?milestone={{.Issue.Milestone.ID}}"> {{.Issue.Milestone.Name}}</a>
  239. {{end}}
  240. </div>
  241. </div>
  242. <div class="ui divider"></div>
  243. <input id="assignee_id" name="assignee_id" type="hidden" value="{{.assignee_id}}">
  244. <div class="ui {{if not .IsRepositoryAdmin}}disabled{{end}} jump select-assignee dropdown">
  245. <span class="text">
  246. <strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
  247. <span class="octicon octicon-gear"></span>
  248. </span>
  249. <div class="menu" data-action="update" data-update-url="{{$.RepoLink}}/issues/{{$.Issue.Index}}/assignee">
  250. <div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_assignee"}}</div>
  251. {{range .Assignees}}
  252. <div class="item" data-id="{{.Id}}" data-href="{{$.RepoLink}}/issues?assignee={{.Id}}" data-avatar="{{.AvatarLink}}"><img src="{{.AvatarLink}}"> {{.Name}}</div>
  253. {{end}}
  254. </div>
  255. </div>
  256. <div class="ui select-assignee list">
  257. <span class="no-select item {{if .Issue.Assignee}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_assignee"}}</span>
  258. <div class="selected">
  259. {{if .Issue.Assignee}}
  260. <a class="item" href="{{$.RepoLink}}/issues?assignee={{.Issue.Assignee.Id}}"><img class="ui avatar image" src="{{.Issue.Assignee.AvatarLink}}"> {{.Issue.Assignee.Name}}</a>
  261. {{end}}
  262. </div>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. <div class="hide" id="edit-content-form">
  268. <div class="ui comment form">
  269. <div class="ui top attached tabular menu">
  270. <a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a>
  271. <a class="preview item" data-url="/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a>
  272. </div>
  273. <div class="ui bottom attached active write tab segment">
  274. <textarea id="content" name="content"></textarea>
  275. </div>
  276. <div class="ui bottom attached tab preview segment markdown">
  277. {{$.i18n.Tr "repo.release.loading"}}
  278. </div>
  279. <div class="text right edit buttons">
  280. <div class="ui basic blue cancel button">{{.i18n.Tr "repo.issues.cancel"}}</div>
  281. <div class="ui green save button">{{.i18n.Tr "repo.issues.save"}}</div>
  282. </div>
  283. </div>
  284. </div>
  285. <div class="hide" id="no-content">
  286. <span class="no-content">{{.i18n.Tr "repo.issues.no_content"}}</span>
  287. </div>