24 lines
521 B
Go
24 lines
521 B
Go
package forum
|
|
|
|
import (
|
|
"github.com/aerogo/aero"
|
|
"github.com/animenotifier/arn"
|
|
"github.com/animenotifier/notify.moe/components"
|
|
)
|
|
|
|
// ThreadsPerPage indicates how many threads are shown on one page.
|
|
const ThreadsPerPage = 20
|
|
|
|
// Get forum category.
|
|
func Get(ctx *aero.Context) string {
|
|
tag := ctx.Get("tag")
|
|
threads := arn.GetThreadsByTag(tag)
|
|
arn.SortThreads(threads)
|
|
|
|
if len(threads) > ThreadsPerPage {
|
|
threads = threads[:ThreadsPerPage]
|
|
}
|
|
|
|
return ctx.HTML(components.Forum(tag, threads, ThreadsPerPage))
|
|
}
|