Improved post toolbar placement

This commit is contained in:
2017-06-20 16:19:43 +02:00
parent 7f8e145a33
commit d314ebb33f
4 changed files with 14 additions and 13 deletions

View File

@ -6,7 +6,8 @@ import (
"github.com/animenotifier/notify.moe/components"
)
const threadsPerPage = 20
// ThreadsPerPage indicates how many threads are shown on one page.
const ThreadsPerPage = 20
// Get forum category.
func Get(ctx *aero.Context) string {
@ -14,9 +15,9 @@ func Get(ctx *aero.Context) string {
threads, _ := arn.GetThreadsByTag(tag)
arn.SortThreads(threads)
if len(threads) > threadsPerPage {
threads = threads[:threadsPerPage]
if len(threads) > ThreadsPerPage {
threads = threads[:ThreadsPerPage]
}
return ctx.HTML(components.Forum(tag, threads))
return ctx.HTML(components.Forum(tag, threads, ThreadsPerPage))
}

View File

@ -1,13 +1,14 @@
component Forum(tag string, threads []*arn.Thread)
component Forum(tag string, threads []*arn.Thread, threadsPerPage int)
h2.page-title Forum
ForumTags
.forum
ThreadList(threads)
.buttons
button
Icon("refresh")
span Load more
if len(threads) == threadsPerPage
.buttons
button
Icon("refresh")
span Load more
component ThreadList(threads []*arn.Thread)
each thread in threads