You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list.tmpl 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. {{template "base/head" .}}
  2. <div class="repository">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. <div class="ui three column stackable grid">
  6. <div class="column">
  7. {{template "repo/issue/navbar" .}}
  8. </div>
  9. <div class="column center aligned">
  10. {{template "repo/issue/search" .}}
  11. </div>
  12. {{if not .Repository.IsArchived}}
  13. <div class="column right aligned">
  14. {{if .PageIsIssueList}}
  15. <a class="ui green button" href="{{.RepoLink}}/issues/new">{{.i18n.Tr "repo.issues.new"}}</a>
  16. {{else}}
  17. <a class="ui green button {{if not .PullRequestCtx.Allowed}}disabled{{end}}" href="{{if .PullRequestCtx.Allowed}}{{.PullRequestCtx.BaseRepo.Link}}/compare/{{.PullRequestCtx.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .PullRequestCtx.BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.Repository.DefaultBranch | EscapePound}}{{end}}">{{.i18n.Tr "repo.pulls.new"}}</a>
  18. {{end}}
  19. </div>
  20. {{else}}
  21. {{if not .PageIsIssueList}}
  22. <div class="column right aligned">
  23. <a class="ui green button {{if not .PullRequestCtx.Allowed}}disabled{{end}}" href="{{if .PullRequestCtx.Allowed}}{{.PullRequestCtx.BaseRepo.Link}}/compare/{{.PullRequestCtx.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .PullRequestCtx.BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.Repository.DefaultBranch | EscapePound}}{{end}}">{{$.i18n.Tr "action.compare_commits_general"}}</a>
  24. </div>
  25. {{end}}
  26. {{end}}
  27. </div>
  28. <div class="ui divider"></div>
  29. <div id="issue-filters" class="ui stackable grid">
  30. <div class="six wide column">
  31. <div class="ui tiny basic status buttons">
  32. <a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
  33. <i class="octicon octicon-issue-opened"></i>
  34. {{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}}
  35. </a>
  36. <a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
  37. <i class="octicon octicon-issue-closed"></i>
  38. {{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}}
  39. </a>
  40. </div>
  41. </div>
  42. <div class="ten wide right aligned column">
  43. <div class="ui secondary filter stackable menu labels">
  44. <!-- Label -->
  45. <div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item label-filter" style="margin-left: auto">
  46. <span class="text">
  47. {{.i18n.Tr "repo.issues.filter_label"}}
  48. <i class="dropdown icon"></i>
  49. </span>
  50. <div class="menu">
  51. <span class="info">{{.i18n.Tr "repo.issues.filter_label_exclude" | Safe}}</span>
  52. <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
  53. {{range .Labels}}
  54. <a class="item has-emoji label-filter-item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.QueryString}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" data-label-id="{{.ID}}"><span class="octicon {{if .IsExcluded}}octicon-circle-slash{{else if .IsSelected}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
  55. {{end}}
  56. </div>
  57. </div>
  58. <!-- Milestone -->
  59. <div class="ui {{if not .Milestones}}disabled{{end}} dropdown jump item">
  60. <span class="text">
  61. {{.i18n.Tr "repo.issues.filter_milestone"}}
  62. <i class="dropdown icon"></i>
  63. </span>
  64. <div class="menu">
  65. <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_milestone_no_select"}}</a>
  66. {{range .Milestones}}
  67. <a class="{{if eq $.MilestoneID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.ID}}&assignee={{$.AssigneeID}}">{{.Name}}</a>
  68. {{end}}
  69. </div>
  70. </div>
  71. <!-- Assignee -->
  72. <div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item">
  73. <span class="text">
  74. {{.i18n.Tr "repo.issues.filter_assignee"}}
  75. <i class="dropdown icon"></i>
  76. </span>
  77. <div class="menu">
  78. <a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}">{{.i18n.Tr "repo.issues.filter_assginee_no_select"}}</a>
  79. {{range .Assignees}}
  80. <a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{.ID}}"><img src="{{.RelAvatarLink}}"> {{.GetDisplayName}}</a>
  81. {{end}}
  82. </div>
  83. </div>
  84. {{if .IsSigned}}
  85. <!-- Type -->
  86. <div class="ui dropdown type jump item">
  87. <span class="text">
  88. {{.i18n.Tr "repo.issues.filter_type"}}
  89. <i class="dropdown icon"></i>
  90. </span>
  91. <div class="menu">
  92. <a class="{{if eq .ViewType "all"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type=all&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_type.all_issues"}}</a>
  93. <a class="{{if eq .ViewType "assigned"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type=assigned&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{.SignedUser.ID}}">{{.i18n.Tr "repo.issues.filter_type.assigned_to_you"}}</a>
  94. <a class="{{if eq .ViewType "created_by"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type=created_by&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_type.created_by_you"}}</a>
  95. <a class="{{if eq .ViewType "mentioned"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type=mentioned&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_type.mentioning_you"}}</a>
  96. </div>
  97. </div>
  98. {{end}}
  99. <!-- Sort -->
  100. <div class="ui dropdown type jump item">
  101. <span class="text">
  102. {{.i18n.Tr "repo.issues.filter_sort"}}
  103. <i class="dropdown icon"></i>
  104. </span>
  105. <div class="menu">
  106. <a class="{{if or (eq .SortType "latest") (not .SortType)}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=latest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
  107. <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=oldest&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
  108. <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=recentupdate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
  109. <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=leastupdate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
  110. <a class="{{if eq .SortType "mostcomment"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=mostcomment&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.mostcomment"}}</a>
  111. <a class="{{if eq .SortType "leastcomment"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=leastcomment&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.leastcomment"}}</a>
  112. <a class="{{if eq .SortType "nearduedate"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=nearduedate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.nearduedate"}}</a>
  113. <a class="{{if eq .SortType "farduedate"}}active{{end}} item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort=farduedate&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}">{{.i18n.Tr "repo.issues.filter_sort.farduedate"}}</a>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. <div id="issue-actions" class="ui stackable grid hide">
  120. <div class="six wide column">
  121. <div class="ui tiny basic status buttons">
  122. <a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state=open&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
  123. <i class="octicon octicon-issue-opened"></i>
  124. {{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}}
  125. </a>
  126. <a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{$.Link}}?q={{$.Keyword}}&type={{.ViewType}}&sort={{$.SortType}}&state=closed&labels={{.SelectLabels}}&milestone={{.MilestoneID}}&assignee={{.AssigneeID}}">
  127. <i class="octicon octicon-issue-closed"></i>
  128. {{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}}
  129. </a>
  130. </div>
  131. </div>
  132. {{/* Ten wide does not cope well and makes the columns stack.
  133. This seems to be related to jQuery's hide/show: in fact, switching
  134. issue-actions and issue-filters and having this ten wide will show
  135. this one correctly, but not the other one. */}}
  136. <div class="nine wide right aligned right floated column">
  137. <div class="ui secondary filter stackable menu">
  138. {{if not .Repository.IsArchived}}
  139. <!-- Action Button -->
  140. {{if .IsShowClosed}}
  141. <div class="ui green active basic button issue-action" data-action="open" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.i18n.Tr "repo.issues.action_open"}}</div>
  142. {{else}}
  143. <div class="ui red active basic button issue-action" data-action="close" data-url="{{$.RepoLink}}/issues/status" style="margin-left: auto">{{.i18n.Tr "repo.issues.action_close"}}</div>
  144. {{end}}
  145. <!-- Labels -->
  146. <div class="ui {{if not .Labels}}disabled{{end}} dropdown jump item">
  147. <span class="text">
  148. {{.i18n.Tr "repo.issues.action_label"}}
  149. <i class="dropdown icon"></i>
  150. </span>
  151. <div class="menu">
  152. {{range .Labels}}
  153. <div class="item issue-action has-emoji" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels">
  154. <span class="octicon {{if eq $.SelectLabels .ID}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}
  155. </div>
  156. {{end}}
  157. </div>
  158. </div>
  159. <!-- Milestone -->
  160. <div class="ui {{if not .Milestones}}disabled{{end}} dropdown jump item">
  161. <span class="text">
  162. {{.i18n.Tr "repo.issues.action_milestone"}}
  163. <i class="dropdown icon"></i>
  164. </span>
  165. <div class="menu">
  166. <div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/milestone">
  167. {{.i18n.Tr "repo.issues.action_milestone_no_select"}}
  168. </div>
  169. {{range .Milestones}}
  170. <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/milestone">
  171. {{.Name}}
  172. </div>
  173. {{end}}
  174. </div>
  175. </div>
  176. <!-- Assignees -->
  177. <div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item">
  178. <span class="text">
  179. {{.i18n.Tr "repo.issues.action_assignee"}}
  180. <i class="dropdown icon"></i>
  181. </span>
  182. <div class="menu">
  183. <div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/assignee">
  184. {{.i18n.Tr "repo.issues.action_assignee_no_select"}}
  185. </div>
  186. {{range .Assignees}}
  187. <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/assignee">
  188. <img src="{{.RelAvatarLink}}"> {{.GetDisplayName}}
  189. </div>
  190. {{end}}
  191. </div>
  192. </div>
  193. {{end}}
  194. </div>
  195. </div>
  196. </div>
  197. <div class="issue list">
  198. {{range .Issues}}
  199. <li class="item">
  200. {{if $.CanWriteIssuesOrPulls}}
  201. <div class="ui checkbox issue-checkbox">
  202. <input type="checkbox" data-issue-id={{.ID}}></input>
  203. </div>
  204. {{end}}
  205. <div class="ui {{if .IsClosed}}{{if .IsPull}}{{if .PullRequest.HasMerged}}purple{{else}}red{{end}}{{else}}red{{end}}{{else}}{{if .IsRead}}white{{else}}green{{end}}{{end}} label">#{{.Index}}</div>
  206. <a class="title has-emoji" href="{{$.Link}}/{{.Index}}">{{.Title}}</a>
  207. {{if .IsPull }}
  208. {{if (index $.CommitStatus .PullRequest.ID)}}
  209. {{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
  210. {{end}}
  211. {{end}}
  212. {{range .Labels}}
  213. <a class="ui label has-emoji" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a>
  214. {{end}}
  215. {{if .NumComments}}
  216. <span class="comment ui right"><i class="octicon octicon-comment"></i> {{.NumComments}}</span>
  217. {{end}}
  218. {{if .TotalTrackedTime}}
  219. <span class="comment ui right"><i class="octicon octicon-clock"></i> {{.TotalTrackedTime | Sec2Time}}</span>
  220. {{end}}
  221. <p class="desc">
  222. {{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
  223. {{if .OriginalAuthor }}
  224. {{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}}
  225. {{else if gt .Poster.ID 0}}
  226. {{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}}
  227. {{else}}
  228. {{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
  229. {{end}}
  230. {{if .Milestone}}
  231. <a class="milestone" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{.Milestone.ID}}&assignee={{$.AssigneeID}}">
  232. <span class="octicon octicon-milestone"></span> {{.Milestone.Name}}
  233. </a>
  234. {{end}}
  235. {{if .Ref}}
  236. <a class="ref" href="{{$.RepoLink}}/src/branch/{{.Ref}}">
  237. <span class="octicon octicon-git-branch"></span> {{.Ref}}
  238. </a>
  239. {{end}}
  240. {{$tasks := .GetTasks}}
  241. {{if gt $tasks 0}}
  242. {{$tasksDone := .GetTasksDone}}
  243. <span class="checklist">
  244. <span class="octicon octicon-checklist"></span> {{$tasksDone}} / {{$tasks}} <span class="progress-bar"><span class="progress" style="width:calc(100% * {{$tasksDone}} / {{$tasks}});"></span></span>
  245. </span>
  246. {{end}}
  247. {{if ne .DeadlineUnix 0}}
  248. <span class="octicon octicon-calendar"></span>
  249. <span{{if .IsOverdue}} class="overdue"{{end}}>{{.DeadlineUnix.FormatShort}}</span>
  250. {{end}}
  251. {{range .Assignees}}
  252. <a class="ui right assignee poping up" href="{{.HomeLink}}" data-content="{{.Name}}" data-variation="inverted" data-position="left center">
  253. <img class="ui avatar image" src="{{.RelAvatarLink}}">
  254. </a>
  255. {{end}}
  256. </p>
  257. </li>
  258. {{end}}
  259. {{template "base/paginate" .}}
  260. </div>
  261. </div>
  262. </div>
  263. {{template "base/footer" .}}