#1459 Dashboard issues lacks sorting

This commit is contained in:
Unknwon 2015-11-04 12:50:02 -05:00
parent 00eb2b221f
commit 603c7389b8
7 changed files with 53 additions and 19 deletions

View file

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png) ![](public/img/gogs-large-resize.png)
##### Current version: 0.6.24 Beta ##### Current version: 0.6.25 Beta
<table> <table>
<tr> <tr>

View file

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.6.24.1104 Beta" const APP_VER = "0.6.25.1104 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View file

@ -2554,17 +2554,23 @@ ol.linenums {
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;
} }
.dashboard.issues .filter.menu .item .text.truncate {
width: 85%;
}
.dashboard.issues .filter.menu .item .floating.label { .dashboard.issues .filter.menu .item .floating.label {
top: 7px; top: 7px;
left: 90%; left: 90%;
width: 15%; width: 15%;
} }
.dashboard.issues .filter.menu .item.active { .dashboard.issues .filter.menu .jump.item {
background-color: #4183c4; margin: 1px;
color: #FFF; padding-right: 0;
} }
.dashboard.issues .filter.menu .item .text { .dashboard.issues .filter.menu .menu {
width: 85%; max-height: 300px;
overflow-x: auto;
right: 0!important;
left: auto!important;
} }
.dashboard.issues .ui.right .head.menu { .dashboard.issues .ui.right .head.menu {
margin-top: -5px; margin-top: -5px;

View file

@ -17,6 +17,9 @@
.text { .text {
height: 16px; height: 16px;
vertical-align: middle; vertical-align: middle;
&.truncate {
width: 85%;
}
} }
.floating.label { .floating.label {
top: 7px; top: 7px;
@ -24,12 +27,17 @@
width: 15%; width: 15%;
} }
} }
.item.active {
background-color: #4183c4; // Sort
color: #FFF; .jump.item {
margin: 1px;
padding-right: 0;
} }
.item .text { .menu {
width: 85%; max-height: 300px;
overflow-x: auto;
right: 0!important;
left: auto!important;
} }
} }
.ui.right .head.menu { .ui.right .head.menu {

View file

@ -156,6 +156,7 @@ func Issues(ctx *middleware.Context) {
// Organization does not have view type and filter mode. // Organization does not have view type and filter mode.
var ( var (
viewType string viewType string
sortType = ctx.Query("sort")
filterMode = models.FM_ALL filterMode = models.FM_ALL
assigneeID int64 assigneeID int64
posterID int64 posterID int64
@ -248,6 +249,7 @@ func Issues(ctx *middleware.Context) {
Page: page, Page: page,
IsClosed: isShowClosed, IsClosed: isShowClosed,
IsPull: isPullList, IsPull: isPullList,
SortType: sortType,
}) })
if err != nil { if err != nil {
ctx.Handle(500, "Issues: %v", err) ctx.Handle(500, "Issues: %v", err)
@ -276,6 +278,7 @@ func Issues(ctx *middleware.Context) {
ctx.Data["IssueStats"] = issueStats ctx.Data["IssueStats"] = issueStats
ctx.Data["ViewType"] = viewType ctx.Data["ViewType"] = viewType
ctx.Data["SortType"] = sortType
ctx.Data["RepoID"] = repoID ctx.Data["RepoID"] = repoID
ctx.Data["IsShowClosed"] = isShowClosed ctx.Data["IsShowClosed"] = isShowClosed
if isShowClosed { if isShowClosed {

View file

@ -1 +1 @@
0.6.24.1104 Beta 0.6.25.1104 Beta

View file

@ -5,23 +5,23 @@
<div class="ui grid"> <div class="ui grid">
<div class="four wide column"> <div class="four wide column">
<div class="ui secondary vertical filter menu"> <div class="ui secondary vertical filter menu">
<a class="{{if eq .ViewType "all"}}ui basic blue button{{end}} item" href="{{.Link}}?repo={{.RepoID}}&state={{.State}}"> <a class="{{if eq .ViewType "all"}}ui basic blue button{{end}} item" href="{{.Link}}?repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
{{.i18n.Tr "home.issues.in_your_repos"}} {{.i18n.Tr "home.issues.in_your_repos"}}
<strong class="ui right">{{.IssueStats.AllCount}}</strong> <strong class="ui right">{{.IssueStats.AllCount}}</strong>
</a> </a>
{{if not .ContextUser.IsOrganization}} {{if not .ContextUser.IsOrganization}}
<a class="{{if eq .ViewType "assigned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&state={{.State}}"> <a class="{{if eq .ViewType "assigned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
{{.i18n.Tr "repo.issues.filter_type.assigned_to_you"}} {{.i18n.Tr "repo.issues.filter_type.assigned_to_you"}}
<strong class="ui right">{{.IssueStats.AssignCount}}</strong> <strong class="ui right">{{.IssueStats.AssignCount}}</strong>
</a> </a>
<a class="{{if eq .ViewType "created_by"}}ui basic blue button{{end}} item" href="{{.Link}}?type=created_by&repo={{.RepoID}}&state={{.State}}"> <a class="{{if eq .ViewType "created_by"}}ui basic blue button{{end}} item" href="{{.Link}}?type=created_by&repo={{.RepoID}}&sort={{$.SortType}}&state={{.State}}">
{{.i18n.Tr "repo.issues.filter_type.created_by_you"}} {{.i18n.Tr "repo.issues.filter_type.created_by_you"}}
<strong class="ui right">{{.IssueStats.CreateCount}}</strong> <strong class="ui right">{{.IssueStats.CreateCount}}</strong>
</a> </a>
{{end}} {{end}}
<div class="ui divider"></div> <div class="ui divider"></div>
{{range .Repos}} {{range .Repos}}
<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}}"> <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}}">
<span class="text truncate">{{$.ContextUser.Name}}/{{.Name}}</span> <span class="text truncate">{{$.ContextUser.Name}}/{{.Name}}</span>
<div class="floating ui {{if $.IsShowClosed}}red{{else}}green{{end}} label">{{if $.IsShowClosed}}{{.NumClosedIssues}}{{else}}{{.NumOpenIssues}}{{end}}</div> <div class="floating ui {{if $.IsShowClosed}}red{{else}}green{{end}} label">{{if $.IsShowClosed}}{{.NumClosedIssues}}{{else}}{{.NumOpenIssues}}{{end}}</div>
</a> </a>
@ -30,15 +30,32 @@
</div> </div>
<div class="twelve wide column content"> <div class="twelve wide column content">
<div class="ui tiny basic status buttons"> <div class="ui tiny basic status buttons">
<a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&state=open"> <a class="ui {{if not .IsShowClosed}}green active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort={{$.SortType}}&state=open">
<i class="octicon octicon-issue-opened"></i> <i class="octicon octicon-issue-opened"></i>
{{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}} {{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}}
</a> </a>
<a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&state=closed"> <a class="ui {{if .IsShowClosed}}red active{{end}} basic button" href="{{.Link}}?type={{$.ViewType}}&repo={{.RepoID}}&sort={{$.SortType}}&state=closed">
<i class="octicon octicon-issue-closed"></i> <i class="octicon octicon-issue-closed"></i>
{{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}} {{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}}
</a> </a>
</div> </div>
<div class="ui right floated secondary filter menu">
<!-- Sort -->
<div class="ui dropdown type jump item">
<span class="text">
{{.i18n.Tr "repo.issues.filter_sort"}}
<i class="dropdown icon"></i>
</span>
<div class="menu">
<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>
<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>
<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>
<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>
<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>
<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>
</div>
</div>
</div>
<div class="issue list"> <div class="issue list">
{{range .Issues}} {{range .Issues}}