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:
parent
a4c9edd0ca
commit
81e67b419a
@ -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 {
|
||||
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user