File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -88,9 +88,11 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
8888 err error
8989 orderBy models.SearchOrderBy
9090 )
91- ctx .Data ["SortType" ] = ctx .Query ("sort" )
9291
92+ ctx .Data ["SortType" ] = ctx .Query ("sort" )
9393 switch ctx .Query ("sort" ) {
94+ case "newest" :
95+ orderBy = models .SearchOrderByNewest
9496 case "oldest" :
9597 orderBy = models .SearchOrderByOldest
9698 case "recentupdate" :
@@ -106,7 +108,8 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
106108 case "size" :
107109 orderBy = models .SearchOrderBySize
108110 default :
109- orderBy = models .SearchOrderByNewest
111+ ctx .Data ["SortType" ] = "recentupdate"
112+ orderBy = models .SearchOrderByRecentUpdated
110113 }
111114
112115 keyword := strings .Trim (ctx .Query ("q" ), " " )
@@ -188,6 +191,8 @@ func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
188191
189192 ctx .Data ["SortType" ] = ctx .Query ("sort" )
190193 switch ctx .Query ("sort" ) {
194+ case "newest" :
195+ orderBy = "id DESC"
191196 case "oldest" :
192197 orderBy = "id ASC"
193198 case "recentupdate" :
@@ -199,7 +204,8 @@ func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
199204 case "alphabetically" :
200205 orderBy = "name ASC"
201206 default :
202- orderBy = "id DESC"
207+ ctx .Data ["SortType" ] = "alphabetically"
208+ orderBy = "name ASC"
203209 }
204210
205211 keyword := strings .Trim (ctx .Query ("q" ), " " )
Original file line number Diff line number Diff line change @@ -126,12 +126,7 @@ func Profile(ctx *context.Context) {
126126 orderBy = models .SearchOrderByAlphabetically
127127 default :
128128 ctx .Data ["SortType" ] = "recentupdate"
129- orderBy = models .SearchOrderByNewest
130- }
131-
132- // set default sort value if sort is empty.
133- if ctx .Query ("sort" ) == "" {
134- ctx .Data ["SortType" ] = "recentupdate"
129+ orderBy = models .SearchOrderByRecentUpdated
135130 }
136131
137132 keyword := strings .Trim (ctx .Query ("q" ), " " )
Original file line number Diff line number Diff line change 66 <i class="dropdown icon"></i>
77 </span>
88 <div class="menu">
9- <a class="{{if or ( eq .SortType "newest") (not .SortType) }}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
9+ <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
1010 <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
1111 <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
1212 <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
You can’t perform that action at this time.
0 commit comments