From d314ebb33fa36dfa99f5d9aa496ee412531df225 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 20 Jun 2017 16:19:43 +0200 Subject: [PATCH] Improved post toolbar placement --- mixins/Postable.pixy | 2 +- pages/forum/forum.go | 9 +++++---- pages/forum/forum.pixy | 11 ++++++----- styles/forum.scarlet | 5 ++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/mixins/Postable.pixy b/mixins/Postable.pixy index 8de32983..a0fce2c7 100644 --- a/mixins/Postable.pixy +++ b/mixins/Postable.pixy @@ -17,7 +17,7 @@ component Postable(post arn.Postable, viewUser *arn.User, highlightAuthorID stri .post-toolbar(id="toolbar-" + post.ID()) .spacer - .post-likes(id="likes-" + post.ID())= len(post.Likes()) + .post-likes(id="likes-" + post.ID(), title="Likes")= len(post.Likes()) //- if user != nil //- if user.ID !== post.authorId diff --git a/pages/forum/forum.go b/pages/forum/forum.go index 33b7ba6a..1d648a98 100644 --- a/pages/forum/forum.go +++ b/pages/forum/forum.go @@ -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)) } diff --git a/pages/forum/forum.pixy b/pages/forum/forum.pixy index bdc977ed..43800d10 100644 --- a/pages/forum/forum.pixy +++ b/pages/forum/forum.pixy @@ -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 diff --git a/styles/forum.scarlet b/styles/forum.scarlet index d652ab1e..e9f64f82 100644 --- a/styles/forum.scarlet +++ b/styles/forum.scarlet @@ -69,9 +69,8 @@ horizontal opacity 0 position absolute - bottom 3px - right 0 - margin-right 0.5rem + bottom 0.25rem + right 0.25rem default-transition .post-tool