From 603c7389b8e56740033e51b36b79e61136b46002 Mon Sep 17 00:00:00 2001 From: Unknwon <u@gogs.io> Date: Wed, 4 Nov 2015 12:50:02 -0500 Subject: [PATCH] #1459 Dashboard issues lacks sorting --- README.md | 2 +- gogs.go | 2 +- public/css/gogs.css | 16 +++++++++++----- public/less/_dashboard.less | 18 +++++++++++++----- routers/user/home.go | 3 +++ templates/.VERSION | 2 +- templates/user/dashboard/issues.tmpl | 29 +++++++++++++++++++++++------ 7 files changed, 53 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 59ba8e21a2..9b7d71c411 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Gogs - Go Git Service [ -##### Current version: 0.6.24 Beta +##### Current version: 0.6.25 Beta <table> <tr> diff --git a/gogs.go b/gogs.go index c903192b84..8fe723fbda 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.6.24.1104 Beta" +const APP_VER = "0.6.25.1104 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/public/css/gogs.css b/public/css/gogs.css index 8448d618fe..8c66cdb3f3 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -2554,17 +2554,23 @@ ol.linenums { height: 16px; vertical-align: middle; } +.dashboard.issues .filter.menu .item .text.truncate { + width: 85%; +} .dashboard.issues .filter.menu .item .floating.label { top: 7px; left: 90%; width: 15%; } -.dashboard.issues .filter.menu .item.active { - background-color: #4183c4; - color: #FFF; +.dashboard.issues .filter.menu .jump.item { + margin: 1px; + padding-right: 0; } -.dashboard.issues .filter.menu .item .text { - width: 85%; +.dashboard.issues .filter.menu .menu { + max-height: 300px; + overflow-x: auto; + right: 0!important; + left: auto!important; } .dashboard.issues .ui.right .head.menu { margin-top: -5px; diff --git a/public/less/_dashboard.less b/public/less/_dashboard.less index d1b194bdcb..19264b0953 100644 --- a/public/less/_dashboard.less +++ b/public/less/_dashboard.less @@ -17,6 +17,9 @@ .text { height: 16px; vertical-align: middle; + &.truncate { + width: 85%; + } } .floating.label { top: 7px; @@ -24,12 +27,17 @@ width: 15%; } } - .item.active { - background-color: #4183c4; - color: #FFF; + + // Sort + .jump.item { + margin: 1px; + padding-right: 0; } - .item .text { - width: 85%; + .menu { + max-height: 300px; + overflow-x: auto; + right: 0!important; + left: auto!important; } } .ui.right .head.menu { diff --git a/routers/user/home.go b/routers/user/home.go index 581bb0633c..c5c42694fa 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -156,6 +156,7 @@ func Issues(ctx *middleware.Context) { // Organization does not have view type and filter mode. var ( viewType string + sortType = ctx.Query("sort") filterMode = models.FM_ALL assigneeID int64 posterID int64 @@ -248,6 +249,7 @@ func Issues(ctx *middleware.Context) { Page: page, IsClosed: isShowClosed, IsPull: isPullList, + SortType: sortType, }) if err != nil { ctx.Handle(500, "Issues: %v", err) @@ -276,6 +278,7 @@ func Issues(ctx *middleware.Context) { ctx.Data["IssueStats"] = issueStats ctx.Data["ViewType"] = viewType + ctx.Data["SortType"] = sortType ctx.Data["RepoID"] = repoID ctx.Data["IsShowClosed"] = isShowClosed if isShowClosed { diff --git a/templates/.VERSION b/templates/.VERSION index fee1aa357c..f116ce5caa 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.6.24.1104 Beta \ No newline at end of file +0.6.25.1104 Beta \ No newline at end of file diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index 092c2523c6..678dfecfc6 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -5,23 +5,23 @@ <div class="ui grid"> <div class="four wide column"> <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"}} <strong class="ui right">{{.IssueStats.AllCount}}</strong> </a> {{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"}} <strong class="ui right">{{.IssueStats.AssignCount}}</strong> </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"}} <strong class="ui right">{{.IssueStats.CreateCount}}</strong> </a> {{end}} <div class="ui divider"></div> {{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> <div class="floating ui {{if $.IsShowClosed}}red{{else}}green{{end}} label">{{if $.IsShowClosed}}{{.NumClosedIssues}}{{else}}{{.NumOpenIssues}}{{end}}</div> </a> @@ -30,15 +30,32 @@ </div> <div class="twelve wide column content"> <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> {{.i18n.Tr "repo.issues.open_tab" .IssueStats.OpenCount}} </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> {{.i18n.Tr "repo.issues.close_tab" .IssueStats.ClosedCount}} </a> </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"> {{range .Issues}}