Skip to content

Commit a025fa7

Browse files
authored
Add alphabetical project sorting (#33504)
Fixes #33500
1 parent fa0c8ae commit a025fa7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

models/project/project.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy {
244244
return db.SearchOrderByRecentUpdated
245245
case "leastupdate":
246246
return db.SearchOrderByLeastUpdated
247+
case "alphabetically":
248+
return "title ASC"
249+
case "reversealphabetically":
250+
return "title DESC"
247251
default:
248252
return db.SearchOrderByNewest
249253
}

templates/projects/list.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
3535
<div class="menu">
3636
<a class="{{if eq .SortType "oldest"}}active {{end}}item" href="?q={{$.Keyword}}&sort=oldest&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a>
37+
<a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="?q={{$.Keyword}}&sort=alphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
38+
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?q={{$.Keyword}}&sort=reversealphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
3739
<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?q={{$.Keyword}}&sort=recentupdate&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a>
3840
<a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?q={{$.Keyword}}&sort=leastupdate&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a>
3941
</div>

0 commit comments

Comments
 (0)