Sort on repo size in admin panel (#1654)

* fix #1653 sort on repo size

* fix minor mistake in en-us locale
This commit is contained in:
Jorrit Klein Bramel 2017-05-02 10:34:28 +02:00 committed by Bo-Yi Wu
parent 3792867955
commit 87efc8c6d4
3 changed files with 8 additions and 0 deletions

View File

@ -667,6 +667,8 @@ issues.label_deletion_desc = Deleting this label will remove its information in
issues.label_deletion_success = This label has been deleted successfully! issues.label_deletion_success = This label has been deleted successfully!
issues.label.filter_sort.alphabetically = Alphabetically issues.label.filter_sort.alphabetically = Alphabetically
issues.label.filter_sort.reverse_alphabetically = Reverse alphabetically issues.label.filter_sort.reverse_alphabetically = Reverse alphabetically
issues.label.filter_sort.by_size = Size
issues.label.filter_sort.reverse_by_size = Reverse size
issues.num_participants = %d Participants issues.num_participants = %d Participants
issues.attachment.open_tab = `Click to see "%s" in a new tab` issues.attachment.open_tab = `Click to see "%s" in a new tab`
issues.attachment.download = `Click to download "%s"` issues.attachment.download = `Click to download "%s"`

View File

@ -94,6 +94,10 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
orderBy = "name DESC" orderBy = "name DESC"
case "alphabetically": case "alphabetically":
orderBy = "name ASC" orderBy = "name ASC"
case "reversesize":
orderBy = "size DESC"
case "size":
orderBy = "size ASC"
default: default:
orderBy = "created_unix DESC" orderBy = "created_unix DESC"
} }

View File

@ -12,6 +12,8 @@
<a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
<a class="{{if eq .SortType "size"}}active{{end}} item" href="{{$.Link}}?sort=size&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.label.filter_sort.by_size"}}</a>
<a class="{{if eq .SortType "reversesize"}}active{{end}} item" href="{{$.Link}}?sort=reversesize&q={{$.Keyword}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_by_size"}}</a>
</div> </div>
</div> </div>
</div> </div>