1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00

Categories: Sort the list

This commit is contained in:
Timur Ismagilov 2022-07-11 13:54:31 +05:00
parent a4c9edd0ca
commit 81e67b419a
2 changed files with 5 additions and 2 deletions

View File

@ -23,7 +23,7 @@ package categories
import "sync"
// listOfCategories returns names of all categories.
// listOfCategories returns unsorted names of all categories.
func listOfCategories() (categoryList []string) {
mutex.RLock()
for cat, _ := range categoryToHyphae {

View File

@ -4,6 +4,7 @@ import (
"embed"
"github.com/bouncepaw/mycorrhiza/viewutil"
"log"
"sort"
"strings"
)
@ -77,10 +78,12 @@ type listData struct {
}
func categoryList(meta viewutil.Meta) {
cats := listOfCategories()
sort.Strings(cats)
viewutil.ExecutePage(meta, viewListChain, listData{
BaseData: &viewutil.BaseData{
Addr: "/category",
},
Categories: listOfCategories(),
Categories: cats,
})
}