view.tmpl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. {{template "base/head_old" .}}
  2. {{template "base/navbar" .}}
  3. {{template "repo/nav" .}}
  4. {{template "repo/toolbar" .}}
  5. <div id="body" class="container">
  6. <div id="issue" data-id="{{.Issue.Id}}">
  7. <div id="issue-{{.Issue.Id}}" class="issue-whole issue-is-opening">
  8. <div class="issue-wrap col-md-10">
  9. <div class="issue-head clearfix">
  10. <div class="number pull-right">#{{.Issue.Index}}</div>
  11. <a class="author pull-left" href="{{AppSubUrl}}/{{.Issue.Poster.Name}}"><img class="avatar" src="{{.Issue.Poster.AvatarLink}}" alt="" width="30"/></a>
  12. <h1 class="title pull-left">{{.Issue.Name}}</h1>
  13. <input id="issue-edit-title" class="form-control input-lg pull-left hidden" type="text" value="{{.Issue.Name}}" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="title"/>
  14. <input type="hidden" value="{{.Issue.Id}}" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="issue_id"/>
  15. <p class="info pull-left">
  16. {{if .IsIssueOwner}}<a class="btn btn-default pull-right issue-edit" href="#" id="issue-edit-btn">Edit</a>
  17. <a class="btn btn-danger pull-right issue-edit-cancel hidden" href="#">Cancel</a>
  18. <a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="{{.RepoLink}}/issues/{{.Issue.Index}}" data-ajax-name="issue-edit-save" data-ajax-method="post">Save</a>{{end}}
  19. <span class="status label label-{{if .Issue.IsClosed}}danger{{else}}success{{end}}">{{if .Issue.IsClosed}}Closed{{else}}Open{{end}}</span>
  20. <a href="{{AppSubUrl}}/{{.Issue.Poster.Name}}" class="author"><strong>{{.Issue.Poster.Name}}</strong></a> opened this issue
  21. <span class="time">{{TimeSince .Issue.Created $.Lang}}</span> · {{.Issue.NumComments}} comments
  22. </p>
  23. </div>
  24. <div class="issue-main">
  25. <div class="panel panel-default issue-content">
  26. <div class="panel-body">
  27. <div class="content markdown">
  28. {{Str2html .Issue.RenderedContent}}
  29. </div>
  30. <div class="issue-edit-content hidden">
  31. <div class="form-group">
  32. <div class="md-help pull-right">Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
  33. </div>
  34. <ul class="nav nav-tabs" data-init="tabs">
  35. <li class="issue-write active"><a href="#issue-edit-textarea" data-toggle="tab">Write</a></li>
  36. <li class="issue-preview"><a href="#issue-edit-preview" data-toggle="tab" data-ajax="/api/v1/markdown" data-ajax-name="issue-edit-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#issue-edit-preview">Preview</a></li>
  37. </ul>
  38. <div class="tab-content">
  39. <div class="tab-pane active" id="issue-edit-textarea">
  40. <div class="form-group">
  41. <input type="hidden" value="1" name="issueIndex">
  42. <textarea class="form-control" name="content" id="issue-edit-content" rows="10" placeholder="Write some content" data-ajax-rel="issue-edit-preview" data-ajax-val="val" data-ajax-field="text">{{.Issue.Content}}</textarea>
  43. </div>
  44. </div>
  45. <div class="tab-pane issue-preview-content" id="issue-edit-preview">Loading...</div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. {{with $attachments := .Issue.Attachments}}
  51. {{if $attachments}}
  52. <div class="attachments">
  53. <span class="attachment-label label label-info">Attachments:</span>
  54. {{range $attachments}}
  55. <a class="attachment label label-default" href="{{.IssueId}}/attachment/{{.Id}}">{{.Name}}</a>
  56. {{end}}
  57. </div>
  58. {{end}}
  59. {{end}}
  60. </div>
  61. {{range .Comments}}
  62. {{/* 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE, 4 = COMMIT, 5 = PULL */}}
  63. {{if eq .Type 0}}
  64. <div class="issue-child" id="issue-comment-{{.Id}}">
  65. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
  66. <div class="issue-content panel panel-default">
  67. <div class="panel-heading">
  68. <a href="{{AppSubUrl}}/{{.Poster.Name}}" class="user">{{.Poster.Name}}</a> commented <span class="time">{{TimeSince .Created $.Lang}}</span>
  69. <!-- <a class="issue-comment-del pull-right issue-action" href="#" title="Edit Comment"><i class="fa fa-times-circle"></i></a>
  70. <a class="issue-comment-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></i></a> -->
  71. <!-- <span class="role label label-default pull-right">Owner</span> -->
  72. </div>
  73. <div class="panel-body markdown">
  74. {{if len .Content}}
  75. {{Str2html .Content}}
  76. {{else}}
  77. <i>No comment entered</i>
  78. {{end}}
  79. </div>
  80. {{with $attachments := .Attachments}}
  81. {{if $attachments}}
  82. <div class="attachments">
  83. <span class="attachment-label label label-info">Attachments:</span>
  84. {{range $attachments}}
  85. <a class="attachment label label-default" href="{{.IssueId}}/attachment/{{.Id}}">{{.Name}}</a>
  86. {{end}}
  87. </div>
  88. {{end}}
  89. {{end}}
  90. </div>
  91. </div>
  92. {{else if eq .Type 1}}
  93. <div class="issue-child issue-opened">
  94. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" /></a>
  95. <div class="issue-content">
  96. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}">{{.Poster.Name}}</a> <span class="label label-success">Reopened</span> this issue <span class="time">{{TimeSince .Created $.Lang}}</span>
  97. </div>
  98. </div>
  99. {{else if eq .Type 2}}
  100. <div class="issue-child issue-closed">
  101. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
  102. <div class="issue-content">
  103. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}">{{.Poster.Name}}</a> <span class="label label-danger">Closed</span> this issue <span class="time">{{TimeSince .Created $.Lang}}</span>
  104. </div>
  105. </div>
  106. {{else if eq .Type 4}}
  107. <div class="issue-child issue-reference issue-reference-commit">
  108. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
  109. <div class="issue-content">
  110. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}">{{.Poster.Name}}</a> <span class="label label-primary">Referenced</span> this issue <span class="time">{{TimeSince .Created $.Lang}}</span>
  111. <p>
  112. <a class="user pull-left" href="{{AppSubUrl}}/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
  113. {{.ContentHtml}}
  114. </p>
  115. </div>
  116. </div>
  117. {{end}}
  118. {{end}}
  119. <hr class="issue-line"/>
  120. {{if .SignedUser}}<div class="issue-child issue-reply">
  121. <a class="user pull-left" href="{{AppSubUrl}}/{{.SignedUser.Name}}"><img class="avatar" src="{{.SignedUser.AvatarLink}}" alt=""/></a>
  122. <form class="panel panel-default issue-content" action="{{.RepoLink}}/comment/new" method="post" enctype="multipart/form-data">
  123. {{.CsrfTokenHtml}}
  124. <div class="panel-body">
  125. <div class="form-group">
  126. <div class="md-help pull-right">Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
  127. </div>
  128. <ul class="nav nav-tabs" data-init="tabs">
  129. <li class="active issue-write"><a href="#issue-textarea" data-toggle="tab">Write</a></li>
  130. <li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/api/v1/markdown" data-ajax-name="issue-preview" data-ajax-context="{{.RepoLink}}" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li>
  131. </ul>
  132. <div class="tab-content">
  133. <div class="tab-pane" id="issue-textarea">
  134. <div class="form-group">
  135. <div id="submit-error" class="text-danger"></div>
  136. <input type="hidden" value="{{.Issue.Index}}" name="issueIndex"/>
  137. <textarea class="form-control" name="content" id="issue-reply-content" rows="10" placeholder="Write some content" data-ajax-rel="issue-preview" data-ajax-val="val" data-ajax-field="text">{{.content}}</textarea>
  138. </div>
  139. </div>
  140. <div class="tab-pane issue-preview-content" id="issue-preview">Loading...</div>
  141. </div>
  142. </div>
  143. {{if .AttachmentsEnabled}}
  144. <div id="attached">
  145. <div id="attached-list">
  146. <b>Attachments:</b>
  147. </div>
  148. </div>
  149. {{end}}
  150. <div class="text-right">
  151. <div class="form-group">
  152. {{if .AttachmentsEnabled}}
  153. <input type="file" accept="{{.AllowedTypes}}" style="display: none;" id="attachments-input" name="attachments" multiple />
  154. <button class="btn-default btn attachment-add" id="attachments-button">Select Attachments...</button>
  155. {{end}}
  156. {{if .IsIssueOwner}}{{if .Issue.IsClosed}}
  157. <input type="submit" class="btn-default btn issue-open" id="issue-open-btn" data-origin="Reopen" data-text="Reopen & Comment" name="change_status" value="Reopen"/>{{else}}
  158. <input type="submit" class="btn-default btn issue-close" id="issue-close-btn" data-origin="Close" data-text="Close & Comment" name="change_status" value="Close"/>{{end}}{{end}}&nbsp;&nbsp;
  159. <button class="btn-success btn" id="issue-reply-btn">Comment</button>
  160. </div>
  161. </div>
  162. </div>
  163. </form>
  164. </div>{{else}}<div class="alert alert-warning"><a class="btn btn-success btn-lg" href="{{AppSubUrl}}/user/sign_up">Sign up for free</a> to join this conversation. Already have an account? <a href="{{AppSubUrl}}/user/login">Sign in to comment</a></div>{{end}}
  165. </div>
  166. </div>
  167. <div class="issue-bar col-md-2">
  168. <div class="labels" data-ajax="{{.Issue.Index}}/label">
  169. {{if .IsRepositoryOwner}}
  170. <div class="pull-right action">
  171. <button class="btn btn-default btn-sm" data-toggle="dropdown">
  172. <i class="fa fa-tags"></i>
  173. <span class="caret"></span>
  174. </button>
  175. <div class="dropdown-menu dropdown-menu-right no">
  176. <ul class="list-unstyled">
  177. {{range .Labels}}
  178. <li class="{{if not .IsChecked}}no-{{end}}checked" data-id="{{.Id}}">
  179. {{if .IsChecked}}<span class="check pull-left"><i class="fa fa-check"></i></span>{{end}}
  180. <span class="color" style="background-color: {{.Color}}"></span>
  181. <span class="name">{{.Name}}</span>
  182. </li>
  183. {{end}}
  184. </ul>
  185. </div>
  186. </div>
  187. {{end}}
  188. <h4>Labels</h4>
  189. {{if .Issue.Labels}}
  190. {{range .Issue.Labels}}
  191. <p id="label-{{.Id}}" class="label-item label-white" style="background-color: {{.Color}}"><strong>{{.Name}}</strong></p>
  192. {{end}}
  193. {{else}}
  194. <p>None yet</p>
  195. {{end}}
  196. </div>
  197. <div class="milestone" data-milestone="{{.Milestone.Id}}" data-ajax="{{.Issue.Index}}/milestone">
  198. <div class="pull-right action">
  199. {{if .IsRepositoryOwner}}
  200. <button class="btn btn-default btn-sm" data-toggle="dropdown">
  201. <i class="fa fa-check-square-o"></i>
  202. <span class="caret"></span>
  203. </button>
  204. <div class="dropdown-menu dropdown-menu-right">
  205. <ul class="list-unstyled">
  206. <li data-id="0" class="clear-milestone milestone-item hidden"><i class="fa fa-times-circle-o"></i> Clear milestone </li>
  207. <li class="milestone-list">
  208. <ul class="nav nav-tabs" data-init="tabs">
  209. <li class="active"><a href="#milestone-open" data-toggle="tab">Open</a></li>
  210. <li><a href="#milestone-close" data-toggle="tab">Closed</a></li>
  211. </ul>
  212. <div class="tab-content">
  213. <div class="tab-pane active" id="milestone-open">
  214. {{if not .OpenMilestones}}
  215. <p class="milestone-item">Nothing to show</p>
  216. {{else}}
  217. <ul class="list-unstyled">
  218. {{range .OpenMilestones}}
  219. <li class="milestone-item" data-id="{{.Id}}">
  220. <p><strong>{{.Name}}</strong></p>
  221. <!-- <p>due to 3 days later</p> -->
  222. </li>
  223. {{end}}
  224. </ul>
  225. {{end}}
  226. </div>
  227. <div class="tab-pane" id="milestone-close">
  228. {{if not .ClosedMilestones}}
  229. <p class="milestone-item">Nothing to show</p>
  230. {{else}}
  231. <ul class="list-unstyled">
  232. {{range .ClosedMilestones}}
  233. <li class="milestone-item" data-id="{{.Id}}">
  234. <p><strong>{{.Name}}</strong></p>
  235. <p>Closed {{TimeSince .ClosedDate $.Lang}}</p>
  236. </li>
  237. {{end}}
  238. </ul>
  239. {{end}}
  240. </div>
  241. </div>
  242. </li>
  243. </ul>
  244. </div>
  245. {{end}}
  246. </div>
  247. <h4>Milestone</h4>
  248. {{if .Milestone}}
  249. <p class="completion{{if eq .Milestone.Completeness 0}} hidden{{end}}"><span style="width:{{.Milestone.Completeness}}%">&nbsp;</span></p>
  250. <p class="name"><strong><a href="{{$.RepoLink}}/issues?milestone={{.Milestone.Index}}{{if $.Issue.IsClosed}}&state=closed{{end}}">{{.Milestone.Name}}</a></strong></p>
  251. {{else}}
  252. <p class="name">No milestone</p>
  253. {{end}}
  254. </div>
  255. <div class="assignee" data-assigned="{{if .Issue.Assignee}}{{.Issue.Assignee.Id}}{{else}}0{{end}}" data-ajax="{{.Issue.Index}}/assignee">{{if .IsRepositoryOwner}}
  256. <div class="pull-right action">
  257. <button type="button" class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown">
  258. <i class="fa fa-group"></i>
  259. <span class="caret"></span>
  260. </button>
  261. <div class="dropdown-menu dropdown-menu-right">
  262. <ul class="list-unstyled">
  263. <li data-uid="0" class="clear-assignee hidden"><i class="fa fa-times-circle-o"></i> Clear assignee</li>
  264. {{range .Collaborators}}
  265. <li data-uid="{{.Id}}"><img src="{{.AvatarLink}}"><strong>{{.Name}}</strong></li>
  266. {{end}}
  267. </ul>
  268. </div>
  269. </div>{{end}}
  270. <h4>Assignee</h4>
  271. <p>{{if .Issue.Assignee}}<img src="{{.Issue.Assignee.AvatarLink}}"><strong>{{.Issue.Assignee.Name}}</strong>{{else}}No one assigned{{end}}</p>
  272. </div>
  273. </div>
  274. </div>
  275. </div>
  276. </div>
  277. {{template "base/footer_old" .}}