#1459 Dashboard issues lacks sorting
This commit is contained in:
		
					parent
					
						
							
								00eb2b221f
							
						
					
				
			
			
				commit
				
					
						603c7389b8
					
				
			
		
					 7 changed files with 53 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -5,7 +5,7 @@ Gogs - Go Git Service [
 | 
			
		||||
 | 
			
		||||
##### Current version: 0.6.24 Beta
 | 
			
		||||
##### Current version: 0.6.25 Beta
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
    <tr>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								gogs.go
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								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())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
0.6.24.1104 Beta
 | 
			
		||||
0.6.25.1104 Beta
 | 
			
		||||
| 
						 | 
				
			
			@ -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}}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue