Ensure channels are sorted
This commit is contained in:
parent
f5e9a0faec
commit
dcd5c1e229
10
web/root.go
10
web/root.go
@ -2,6 +2,7 @@ package web
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/Jaculabilis/intake/core"
|
"github.com/Jaculabilis/intake/core"
|
||||||
"github.com/Jaculabilis/intake/web/html"
|
"github.com/Jaculabilis/intake/web/html"
|
||||||
@ -26,9 +27,14 @@ func (env *Env) getRoot(writer http.ResponseWriter, req *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(writer, err.Error(), 500)
|
http.Error(writer, err.Error(), 500)
|
||||||
}
|
}
|
||||||
|
var channelNames []string
|
||||||
|
for name := range channels {
|
||||||
|
channelNames = append(channelNames, name)
|
||||||
|
}
|
||||||
|
sort.Strings(channelNames)
|
||||||
var channelData []html.ChannelData
|
var channelData []html.ChannelData
|
||||||
for name, active := range channels {
|
for _, name := range channelNames {
|
||||||
channelData = append(channelData, html.ChannelData{Name: name, Active: active})
|
channelData = append(channelData, html.ChannelData{Name: name, Active: channels[name]})
|
||||||
}
|
}
|
||||||
|
|
||||||
data := html.HomeData{
|
data := html.HomeData{
|
||||||
|
Loading…
Reference in New Issue
Block a user