Skip to content

Commit 9a6757c

Browse files
committed
use new issue list on dashboard as well
1 parent c60029c commit 9a6757c

File tree

9 files changed

+291
-393
lines changed

9 files changed

+291
-393
lines changed

templates/repo/issue/list.tmpl

Lines changed: 2 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -200,136 +200,8 @@
200200
</div>
201201
</div>
202202
</div>
203-
204-
<div class="issue list">
205-
{{ $approvalCounts := .ApprovalCounts}}
206-
{{range .Issues}}
207-
<li class="item df py-3">
208-
<div class="issue-item-left df py-2">
209-
{{if $.CanWriteIssuesOrPulls}}
210-
<div class="ui checkbox issue-checkbox">
211-
<input type="checkbox" data-issue-id={{.ID}}></input>
212-
<label></label>
213-
</div>
214-
{{end}}
215-
<div class="issue-item-icon">
216-
{{if .IsPull}}
217-
{{if .PullRequest.HasMerged}}
218-
{{svg "octicon-git-merge" 16 "text purple"}}
219-
{{else}}
220-
{{if .IsClosed}}
221-
{{svg "octicon-git-pull-request" 16 "text red"}}
222-
{{else}}
223-
{{svg "octicon-git-pull-request" 16 "text green"}}
224-
{{end}}
225-
{{end}}
226-
{{else}}
227-
{{if .IsClosed}}
228-
{{svg "octicon-issue-opened" 16 "text red"}}
229-
{{else}}
230-
{{svg "octicon-issue-closed" 16 "text green"}}
231-
{{end}}
232-
{{end}}
233-
</div>
234-
</div>
235-
<div class="issue-item-main f1 fc df">
236-
<div class="issue-item-top-row df ac">
237-
<a class="title my-1 mr-2" href="{{$.Link}}/{{.Index}}">{{RenderEmoji .Title}}</a>
238-
{{if .IsPull }}
239-
{{if (index $.CommitStatus .PullRequest.ID)}}
240-
{{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
241-
{{end}}
242-
{{end}}
243-
{{range .Labels}}
244-
<a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
245-
{{end}}
246-
</div>
247-
<div class="desc issue-item-bottom-row df ac my-1">
248-
<span class="index mr-2">
249-
#{{.Index}}
250-
</span>
251-
{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
252-
{{if .OriginalAuthor }}
253-
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}}
254-
{{else if gt .Poster.ID 0}}
255-
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}}
256-
{{else}}
257-
{{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
258-
{{end}}
259-
{{if .Milestone}}
260-
<a class="milestone" href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}">
261-
{{svg "octicon-milestone" 14}} {{.Milestone.Name}}
262-
</a>
263-
{{end}}
264-
{{if .Ref}}
265-
<a class="ref" href="{{index $.IssueRefURLs .ID}}">
266-
{{svg "octicon-git-branch" 14}} {{index $.IssueRefEndNames .ID}}
267-
</a>
268-
{{end}}
269-
{{$tasks := .GetTasks}}
270-
{{if gt $tasks 0}}
271-
{{$tasksDone := .GetTasksDone}}
272-
<span class="checklist">
273-
{{svg "octicon-checklist" 14}} {{$tasksDone}} / {{$tasks}} <span class="progress-bar"><span class="progress" style="width:calc(100% * {{$tasksDone}} / {{$tasks}});"></span></span>
274-
</span>
275-
{{end}}
276-
{{if ne .DeadlineUnix 0}}
277-
<span class="due-date poping up" data-content="{{$.i18n.Tr "repo.issues.due_date"}}" data-variation="tiny inverted" data-position="right center">
278-
{{svg "octicon-calendar" 14}}<span{{if .IsOverdue}} class="overdue"{{end}}>{{.DeadlineUnix.FormatShort}}</span>
279-
</span>
280-
{{end}}
281-
{{if .IsPull}}
282-
{{$approveOfficial := call $approvalCounts .ID "approve"}}
283-
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
284-
{{$waitingOfficial := call $approvalCounts .ID "waiting"}}
285-
{{if gt $approveOfficial 0}}
286-
<span class="approvals">{{svg "octicon-check" 14}}
287-
{{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}}
288-
</span>
289-
{{end}}
290-
291-
{{if gt $rejectOfficial 0}}
292-
<span class="rejects">{{svg "octicon-diff" 14}}
293-
{{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}}
294-
</span>
295-
{{end}}
296-
297-
{{if gt $waitingOfficial 0}}
298-
<span class="waiting">{{svg "octicon-eye" 14}}
299-
{{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}}
300-
</span>
301-
{{end}}
302-
303-
{{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}}
304-
<span class="conflicting">{{svg "octicon-x" 14}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}}</span>
305-
{{end}}
306-
{{end}}
307-
</div>
308-
</div>
309-
<div class="issue-item-icons-right df p-2">
310-
<div class="issue-item-icon-right text grey">
311-
{{if .TotalTrackedTime}}
312-
{{svg "octicon-clock" 16 "mr-2"}}{{.TotalTrackedTime | Sec2Time}}
313-
{{end}}
314-
</div>
315-
<div class="issue-item-icon-right text grey">
316-
{{range .Assignees}}
317-
<a class="ui assignee poping up" href="{{.HomeLink}}" data-content="{{.GetDisplayName}}" data-variation="inverted" data-position="left center">
318-
<img class="ui avatar image" src="{{.RelAvatarLink}}">
319-
</a>
320-
{{end}}
321-
</div>
322-
<div class="issue-item-icon-right text grey">
323-
{{if .NumComments}}
324-
{{svg "octicon-comment" 16 "mr-2"}}{{.NumComments}}
325-
{{end}}
326-
</div>
327-
</div>
328-
</li>
329-
{{end}}
330-
331-
{{template "base/paginate" .}}
332-
</div>
203+
{{template "shared/issuelist" .}}
204+
{{template "base/paginate" .}}
333205
</div>
334206
</div>
335207
{{template "base/footer" .}}

templates/shared/issuelist.tmpl

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<div class="issue list">
2+
{{ $approvalCounts := .ApprovalCounts}}
3+
{{range .Issues}}
4+
<li class="item df py-3">
5+
<div class="issue-item-left df py-2">
6+
{{if $.CanWriteIssuesOrPulls}}
7+
<div class="ui checkbox issue-checkbox">
8+
<input type="checkbox" data-issue-id={{.ID}}></input>
9+
<label></label>
10+
</div>
11+
{{end}}
12+
<div class="issue-item-icon">
13+
{{if .IsPull}}
14+
{{if .PullRequest.HasMerged}}
15+
{{svg "octicon-git-merge" 16 "text purple"}}
16+
{{else}}
17+
{{if .IsClosed}}
18+
{{svg "octicon-git-pull-request" 16 "text red"}}
19+
{{else}}
20+
{{svg "octicon-git-pull-request" 16 "text green"}}
21+
{{end}}
22+
{{end}}
23+
{{else}}
24+
{{if .IsClosed}}
25+
{{svg "octicon-issue-opened" 16 "text red"}}
26+
{{else}}
27+
{{svg "octicon-issue-closed" 16 "text green"}}
28+
{{end}}
29+
{{end}}
30+
</div>
31+
</div>
32+
<div class="issue-item-main f1 fc df">
33+
<div class="issue-item-top-row df ac fw">
34+
<a class="title my-1 mr-2" href="{{if .HTMLURL}}{{.HTMLURL}}{{else}}{{$.Link}}/{{.Index}}{{end}}">{{RenderEmoji .Title}}</a>
35+
{{if .IsPull }}
36+
{{if (index $.CommitStatus .PullRequest.ID)}}
37+
{{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
38+
{{end}}
39+
{{end}}
40+
{{range .Labels}}
41+
<a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
42+
{{end}}
43+
</div>
44+
<div class="desc issue-item-bottom-row df ac my-1">
45+
<a class="index ml-0 mr-2" href="{{if .HTMLURL}}{{.HTMLURL}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
46+
#{{.Index}}
47+
</a>
48+
{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
49+
{{if .OriginalAuthor }}
50+
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}}
51+
{{else if gt .Poster.ID 0}}
52+
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}}
53+
{{else}}
54+
{{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
55+
{{end}}
56+
{{if .Milestone}}
57+
<a class="milestone" {{if $.RepoLink}}href="{{$.RepoLink}}/milestone/{{.Milestone.ID}}"{{else}}href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/milestone/{{.Milestone.ID}}"{{end}}>
58+
{{svg "octicon-milestone" 14 "mr-2"}}{{.Milestone.Name}}
59+
</a>
60+
{{end}}
61+
{{if .Ref}}
62+
<a class="ref" {{if $.RepoLink}}href="{{$.RepoLink}}{{index $.IssueRefURLs .ID}}"{{else}}href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}{{index $.IssueRefURLs .ID}}"{{end}}>
63+
{{svg "octicon-git-branch" 14 "mr-2"}}{{index $.IssueRefEndNames .ID}}
64+
</a>
65+
{{end}}
66+
{{$tasks := .GetTasks}}
67+
{{if gt $tasks 0}}
68+
{{$tasksDone := .GetTasksDone}}
69+
<span class="checklist">
70+
{{svg "octicon-checklist" 14 "mr-2"}}{{$tasksDone}} / {{$tasks}} <span class="progress-bar"><span class="progress" style="width:calc(100% * {{$tasksDone}} / {{$tasks}});"></span></span>
71+
</span>
72+
{{end}}
73+
{{if ne .DeadlineUnix 0}}
74+
<span class="due-date poping up" data-content="{{$.i18n.Tr "repo.issues.due_date"}}" data-variation="tiny inverted" data-position="right center">
75+
{{svg "octicon-calendar" 14 "mr-2"}}<span{{if .IsOverdue}} class="overdue"{{end}}>{{.DeadlineUnix.FormatShort}}</span>
76+
</span>
77+
{{end}}
78+
{{if .IsPull}}
79+
{{$approveOfficial := call $approvalCounts .ID "approve"}}
80+
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
81+
{{$waitingOfficial := call $approvalCounts .ID "waiting"}}
82+
{{if gt $approveOfficial 0}}
83+
<span class="approvals df ac">
84+
{{svg "octicon-check" 14 "mr-2"}}
85+
{{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}}
86+
</span>
87+
{{end}}
88+
{{if gt $rejectOfficial 0}}
89+
<span class="rejects df ac">
90+
{{svg "octicon-diff" 14 "mr-2"}}
91+
{{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}}
92+
</span>
93+
{{end}}
94+
{{if gt $waitingOfficial 0}}
95+
<span class="waiting df ac">
96+
{{svg "octicon-eye" 14}}
97+
{{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}}
98+
</span>
99+
{{end}}
100+
{{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}}
101+
<span class="conflicting df ac">
102+
{{svg "octicon-x" 14}}
103+
{{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}}
104+
</span>
105+
{{end}}
106+
{{end}}
107+
</div>
108+
</div>
109+
<div class="issue-item-icons-right df p-2">
110+
<div class="issue-item-icon-right text grey">
111+
{{if .TotalTrackedTime}}
112+
{{svg "octicon-clock" 16 "mr-2"}}
113+
{{.TotalTrackedTime | Sec2Time}}
114+
{{end}}
115+
</div>
116+
<div class="issue-item-icon-right text grey">
117+
{{range .Assignees}}
118+
<a class="ui assignee poping up" href="{{.HomeLink}}" data-content="{{.GetDisplayName}}" data-variation="inverted" data-position="left center">
119+
<img class="ui avatar image" src="{{.RelAvatarLink}}">
120+
</a>
121+
{{end}}
122+
</div>
123+
<div class="issue-item-icon-right text grey">
124+
{{if .NumComments}}
125+
<a href="{{if .HTMLURL}}{{.HTMLURL}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
126+
{{svg "octicon-comment" 16 "mr-2"}}{{.NumComments}}
127+
</a>
128+
{{end}}
129+
</div>
130+
</div>
131+
</li>
132+
{{end}}
133+
</div>

templates/user/dashboard/issues.tmpl

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -97,110 +97,8 @@
9797
</div>
9898
</div>
9999
</div>
100-
101-
<div class="issue list">
102-
{{ $approvalCounts := .ApprovalCounts}}
103-
{{range .Issues}}
104-
105-
{{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }}
106-
{{if .Repo}}
107-
<li class="item">
108-
<div class="ui label">{{.Repo.FullName}}#{{.Index}}</div>
109-
<a class="title" href="{{.HTMLURL}}">{{RenderEmoji .Title}}</a>
110-
111-
{{if .IsPull}}
112-
{{if (index $.CommitStatus .PullRequest.ID)}}
113-
{{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
114-
{{end}}
115-
{{end}}
116-
117-
{{with .Labels}}
118-
{{/* If we have any labels, we should show them
119-
with a 2.5 line height, this way they don't look
120-
awful and they don't stack on top of each other,
121-
especially on mobile views. */}}
122-
<span style="line-height: 2.5">
123-
{{range .}}
124-
<a class="ui label" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}&assignee={{$.AssigneeID}}&repos=[{{range $.RepoIDs}}{{.}}%2C{{end}}]" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
125-
{{end}}
126-
</span>
127-
{{end}}
128-
129-
{{if .NumComments}}
130-
<span class="comment ui right">{{svg "octicon-comment"}} {{.NumComments}}</span>
131-
{{end}}
132-
{{if .TotalTrackedTime}}
133-
<span class="comment ui right">{{svg "octicon-clock"}} {{.TotalTrackedTime | Sec2Time}}</span>
134-
{{end}}
135-
136-
<p class="desc">
137-
{{if .OriginalAuthor}}
138-
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}}
139-
{{else if gt .Poster.ID 0}}
140-
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName|Escape) | Safe}}
141-
{{else}}
142-
{{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName|Escape) | Safe}}
143-
{{end}}
144-
{{if .Milestone}}
145-
<a class="milestone" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/milestone/{{.Milestone.ID}}">
146-
{{svg "octicon-milestone"}} {{.Milestone.Name}}
147-
</a>
148-
{{end}}
149-
{{if .Ref}}
150-
<a class="ref" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}{{index $.IssueRefURLs .ID}}">
151-
{{svg "octicon-git-branch"}} {{index $.IssueRefEndNames .ID}}
152-
</a>
153-
{{end}}
154-
{{range .Assignees}}
155-
<a class="ui right assignee poping up" href="{{.HomeLink}}" data-content="{{.GetDisplayName}}" data-variation="inverted" data-position="left center">
156-
<img class="ui avatar image" src="{{.RelAvatarLink}}">
157-
</a>
158-
{{end}}
159-
{{$tasks := .GetTasks}}
160-
{{if gt $tasks 0}}
161-
{{$tasksDone := .GetTasksDone}}
162-
<span class="checklist">
163-
{{svg "octicon-checklist"}} {{$tasksDone}} / {{$tasks}} <span class="progress-bar"><span class="progress" style="width:calc(100% * {{$tasksDone}} / {{$tasks}});"></span></span>
164-
</span>
165-
{{end}}
166-
{{if ne .DeadlineUnix 0}}
167-
<span class="due-date poping up" data-content="{{$.i18n.Tr "repo.issues.due_date"}}" data-variation="tiny inverted" data-position="right center">
168-
{{svg "octicon-calendar"}}<span{{if .IsOverdue}} class="overdue"{{end}}>{{.DeadlineUnix.FormatShort}}</span>
169-
</span>
170-
{{end}}
171-
{{if .IsPull}}
172-
{{$approveOfficial := call $approvalCounts .ID "approve"}}
173-
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
174-
{{$waitingOfficial := call $approvalCounts .ID "waiting"}}
175-
{{if gt $approveOfficial 0}}
176-
<span class="approvals">{{svg "octicon-check"}}
177-
{{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}}
178-
</span>
179-
{{end}}
180-
181-
{{if gt $rejectOfficial 0}}
182-
<span class="rejects">{{svg "octicon-diff"}}
183-
{{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}}
184-
</span>
185-
{{end}}
186-
187-
{{if gt $waitingOfficial 0}}
188-
<span class="waiting">{{svg "octicon-eye"}}
189-
{{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}}
190-
</span>
191-
{{end}}
192-
193-
{{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}}
194-
<span class="conflicting">{{svg "octicon-x"}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}}</span>
195-
{{end}}
196-
{{end}}
197-
</p>
198-
</li>
199-
{{end}}
200-
{{end}}
201-
202-
{{template "base/paginate" .}}
203-
</div>
100+
{{template "shared/issuelist" .}}
101+
{{template "base/paginate" .}}
204102
</div>
205103
</div>
206104
</div>

0 commit comments

Comments
 (0)