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"
|
import "sync"
|
||||||
|
|
||||||
// listOfCategories returns names of all categories.
|
// listOfCategories returns unsorted names of all categories.
|
||||||
func listOfCategories() (categoryList []string) {
|
func listOfCategories() (categoryList []string) {
|
||||||
mutex.RLock()
|
mutex.RLock()
|
||||||
for cat, _ := range categoryToHyphae {
|
for cat, _ := range categoryToHyphae {
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"embed"
|
"embed"
|
||||||
"github.com/bouncepaw/mycorrhiza/viewutil"
|
"github.com/bouncepaw/mycorrhiza/viewutil"
|
||||||
"log"
|
"log"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -77,10 +78,12 @@ type listData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func categoryList(meta viewutil.Meta) {
|
func categoryList(meta viewutil.Meta) {
|
||||||
|
cats := listOfCategories()
|
||||||
|
sort.Strings(cats)
|
||||||
viewutil.ExecutePage(meta, viewListChain, listData{
|
viewutil.ExecutePage(meta, viewListChain, listData{
|
||||||
BaseData: &viewutil.BaseData{
|
BaseData: &viewutil.BaseData{
|
||||||
Addr: "/category",
|
Addr: "/category",
|
||||||
},
|
},
|
||||||
Categories: listOfCategories(),
|
Categories: cats,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user