Skip to content

Commit 603c738

Browse files
committed
gogs#1459 Dashboard issues lacks sorting
1 parent 00eb2b2 commit 603c738

File tree

7 files changed

+53
-19
lines changed

7 files changed

+53
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
55

66
![](public/img/gogs-large-resize.png)
77

8-
##### Current version: 0.6.24 Beta
8+
##### Current version: 0.6.25 Beta
99

1010
<table>
1111
<tr>

gogs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/gogits/gogs/modules/setting"
1818
)
1919

20-
const APP_VER = "0.6.24.1104 Beta"
20+
const APP_VER = "0.6.25.1104 Beta"
2121

2222
func init() {
2323
runtime.GOMAXPROCS(runtime.NumCPU())

public/css/gogs.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,17 +2554,23 @@ ol.linenums {
25542554
height: 16px;
25552555
vertical-align: middle;
25562556
}
2557+
.dashboard.issues .filter.menu .item .text.truncate {
2558+
width: 85%;
2559+
}
25572560
.dashboard.issues .filter.menu .item .floating.label {
25582561
top: 7px;
25592562
left: 90%;
25602563
width: 15%;
25612564
}
2562-
.dashboard.issues .filter.menu .item.active {
2563-
background-color: #4183c4;
2564-
color: #FFF;
2565+
.dashboard.issues .filter.menu .jump.item {
2566+
margin: 1px;
2567+
padding-right: 0;
25652568
}
2566-
.dashboard.issues .filter.menu .item .text {
2567-
width: 85%;
2569+
.dashboard.issues .filter.menu .menu {
2570+
max-height: 300px;
2571+
overflow-x: auto;
2572+
right: 0!important;
2573+
left: auto!important;
25682574
}
25692575
.dashboard.issues .ui.right .head.menu {
25702576
margin-top: -5px;

public/less/_dashboard.less

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,27 @@
1717
.text {
1818
height: 16px;
1919
vertical-align: middle;
20+
&.truncate {
21+
width: 85%;
22+
}
2023
}
2124
.floating.label {
2225
top: 7px;
2326
left: 90%;
2427
width: 15%;
2528
}
2629
}
27-
.item.active {
28-
background-color: #4183c4;
29-
color: #FFF;
30+
31+
// Sort
32+
.jump.item {
33+
margin: 1px;
34+
padding-right: 0;
3035
}
31-
.item .text {
32-
width: 85%;
36+
.menu {
37+
max-height: 300px;
38+
overflow-x: auto;
39+
right: 0!important;
40+
left: auto!important;
3341
}
3442
}
3543
.ui.right .head.menu {

routers/user/home.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ func Issues(ctx *middleware.Context) {
156156
// Organization does not have view type and filter mode.
157157
var (
158158
viewType string
159+
sortType = ctx.Query("sort")
159160
filterMode = models.FM_ALL
160161
assigneeID int64
161162
posterID int64
@@ -248,6 +249,7 @@ func Issues(ctx *middleware.Context) {
248249
Page: page,
249250
IsClosed: isShowClosed,
250251
IsPull: isPullList,
252+
SortType: sortType,
251253
})
252254
if err != nil {
253255
ctx.Handle(500, "Issues: %v", err)
@@ -276,6 +278,7 @@ func Issues(ctx *middleware.Context) {
276278

277279
ctx.Data["IssueStats"] = issueStats
278280
ctx.Data["ViewType"] = viewType
281+
ctx.Data["SortType"] = sortType
279282
ctx.Data["RepoID"] = repoID
280283
ctx.Data["IsShowClosed"] = isShowClosed
281284
if isShowClosed {

templates/.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.24.1104 Beta
1+
0.6.25.1104 Beta

templates/user/dashboard/issues.tmpl

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
<div class="ui grid">
66
<div class="four wide column">
77
<div class="ui secondary vertical filter menu">
8-
<a class="{{if eq .ViewType "all"}}ui basic blue button{{end}} item" href="{{.Link}}?repo={{.RepoID}}&state={{.State}}">
8+
<a class="{{if eq .ViewType "all"}}ui basic blue button{{end}} item" href="{{.Link}}?repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
99
{{.i18n.Tr "home.issues.in_your_repos"}}
1010
<strong class="ui right">{{.IssueStats.AllCount}}</strong>
1111
</a>
1212
{{if not .ContextUser.IsOrganization}}
13-
<a class="{{if eq .ViewType "assigned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&state={{.State}}">
13+
<a class="{{if eq .ViewType "assigned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
1414
{{.i18n.Tr "repo.issues.filter_type.assigned_to_you"}}
1515
<strong class="ui right">{{.IssueStats.AssignCount}}</strong>
1616
</a>
17-
<a class="{{if eq .ViewType "created_by"}}ui basic blue button{{end}} item" href="{{.Link}}?type=created_by&repo={{.RepoID}}&state={{.State}}">
17+
<a class="{{if eq .ViewType "created_by"}}ui basic blue button{{end}} item" href="{{.Link}}?type=created_by&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
1818
{{.i18n.Tr "repo.issues.filter_type.created_by_you"}}
1919
<strong class="ui right">{{.IssueStats.CreateCount}}</strong>
2020
</a>
2121
{{end}}
2222
<div class="ui divider"></div>
2323
{{range .Repos}}
24-
<a class="{{if eq $.RepoID .ID}}ui basic blue button{{end}} repo name item" href="{{$.Link}}?type={{$.ViewType}}{{if not (eq $.RepoID .ID)}}&repo={{.ID}}{{end}}&state={{$.State}}">
24+
<a class="{{if eq $.RepoID .ID}}ui basic blue button{{end}} repo name item" href="{{$.Link}}?type={{$.ViewType}}{{if not (eq $.RepoID .ID)}}&repo={{.ID}}{{end}}&sort={{$.SortType}}&state={{$.State}}">
2525
<span class="text truncate">{{$.ContextUser.Name}}/{{.Name}}</span>
2626
<div class="floating ui {{if $.IsShowClosed}}red{{else}}green{{end}} label">{{if $.IsShowClosed}}{{.NumClosedIssues}}{{else}}{{.NumOpenIssues}}{{end}}</div>
2727
</a>
@@ -30,15 +30,32 @@
3030
</div>
3131
<div class="twelve wide column content">
3232
<div class="ui tiny basic status buttons">
33-
<a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&state=open">
33+
<a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort={{$.SortType}}&state=open">
3434
<i class="octicon octicon-issue-opened"></i>
3535
{{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}}
3636
</a>
37-
<a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&state=closed">
37+
<a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort={{$.SortType}}&state=closed">
3838
<i class="octicon octicon-issue-closed"></i>
3939
{{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}}
4040
</a>
4141
</div>
42+
<div class="ui right floated secondary filter menu">
43+
<!-- Sort -->
44+
<div class="ui dropdown type jump item">
45+
<span class="text">
46+
{{.i18n.Tr "repo.issues.filter_sort"}}
47+
<i class="dropdown icon"></i>
48+
</span>
49+
<div class="menu">
50+
<a class="{{if or (eq .SortType "latest") (not .SortType)}}active{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort=latest&state={{$.State}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
51+
<a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort=oldest&state={{$.State}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
52+
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort=recentupdate&state={{$.State}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
53+
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort=leastupdate&state={{$.State}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
54+
<a class="{{if eq .SortType "mostcomment"}}active{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort=mostcomment&state={{$.State}}">{{.i18n.Tr "repo.issues.filter_sort.mostcomment"}}</a>
55+
<a class="{{if eq .SortType "leastcomment"}}active{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort=leastcomment&state={{$.State}}">{{.i18n.Tr "repo.issues.filter_sort.leastcomment"}}</a>
56+
</div>
57+
</div>
58+
</div>
4259

4360
<div class="issue list">
4461
{{range .Issues}}

0 commit comments

Comments
 (0)