2016-11-19 14:54:31 +00:00
|
|
|
package forum
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
"github.com/aerogo/aero"
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
const threadsPerPage = 20
|
|
|
|
|
|
|
|
// Get ...
|
|
|
|
func Get(ctx *aero.Context) string {
|
|
|
|
tag := ctx.Get("tag")
|
|
|
|
threads, _ := arn.GetThreadsByTag(tag)
|
|
|
|
|
|
|
|
sort.Sort(threads)
|
|
|
|
|
|
|
|
if len(threads) > threadsPerPage {
|
|
|
|
threads = threads[:threadsPerPage]
|
|
|
|
}
|
|
|
|
|
2016-11-19 18:02:33 +00:00
|
|
|
return ctx.HTML(components.Forum(tag, threads))
|
2016-11-19 14:54:31 +00:00
|
|
|
}
|