From dddb066b0de7f2ee71e5f9f751a529555cd0b963 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 25 Feb 2018 17:06:47 +0100 Subject: [PATCH] Quotes cleanup --- mixins/Quote.pixy | 4 ++-- pages/character/character.pixy | 1 + pages/character/character.scarlet | 8 +++----- pages/quotes/quotes.go | 14 ++++++++++---- pages/quotes/quotes.pixy | 6 +++--- pages/quotes/quotes.scarlet | 16 +--------------- 6 files changed, 20 insertions(+), 29 deletions(-) diff --git a/mixins/Quote.pixy b/mixins/Quote.pixy index da4eef90..cae68b94 100644 --- a/mixins/Quote.pixy +++ b/mixins/Quote.pixy @@ -1,5 +1,5 @@ component Quote(quote *arn.Quote) - .quote.mountable(id=quote.ID) + .quote.mountable QuoteContent(quote) QuoteFooter(quote) @@ -19,4 +19,4 @@ component QuoteFooter(quote *arn.Quote) span posted span.utc-date(data-date=quote.Created) span by - a.ajax(href=quote.Creator().Link())= quote.Creator().Nick + " " + a.ajax(href=quote.Creator().Link())= quote.Creator().Nick diff --git a/pages/character/character.pixy b/pages/character/character.pixy index ca598cdd..76fb830d 100644 --- a/pages/character/character.pixy +++ b/pages/character/character.pixy @@ -15,6 +15,7 @@ component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime each anime in characterAnime a.character-anime-item.ajax(href=anime.Link(), title=anime.Title.ByUser(user)) img.character-anime-item-image.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.ByUser(user)) + if len(quotes) >0 h3 Quotes .character-quotes diff --git a/pages/character/character.scarlet b/pages/character/character.scarlet index 0da011c3..2446895c 100644 --- a/pages/character/character.scarlet +++ b/pages/character/character.scarlet @@ -42,13 +42,11 @@ anime-mini-item-image .character-quotes - horizontal-wrap - justify-content space-around + vertical .character-quote - flex-basis 400px - - footer + footer, + .quote-footer display none > 1250px diff --git a/pages/quotes/quotes.go b/pages/quotes/quotes.go index 35b13068..14487efa 100644 --- a/pages/quotes/quotes.go +++ b/pages/quotes/quotes.go @@ -1,15 +1,16 @@ package quotes import ( + "net/http" + "strconv" + "github.com/aerogo/aero" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/utils" - "net/http" - "strconv" ) -const maxQuotes = 12 +const maxQuotes = 6 // Latest renders the quotes page. func Latest(ctx *aero.Context) string { @@ -21,10 +22,15 @@ func Latest(ctx *aero.Context) string { arn.SortQuotesLatestFirst(quotes) + // Reduce the number of displayed quotes + loadMoreIndex := 0 + if len(quotes) > maxQuotes { quotes = quotes[:maxQuotes] + loadMoreIndex = maxQuotes } - return ctx.HTML(components.Quotes(quotes, maxQuotes, user)) + + return ctx.HTML(components.Quotes(quotes, loadMoreIndex, user)) } // LatestFrom renders the quotes from the given index. diff --git a/pages/quotes/quotes.pixy b/pages/quotes/quotes.pixy index 7d947aa5..22afa5ae 100644 --- a/pages/quotes/quotes.pixy +++ b/pages/quotes/quotes.pixy @@ -1,4 +1,4 @@ -component Quotes(quotes []*arn.Quote, quotesPerPage int, user *arn.User) +component Quotes(quotes []*arn.Quote, loadMoreIndex int, user *arn.User) h1.page-title Quotes QuotesTabs @@ -17,9 +17,9 @@ component Quotes(quotes []*arn.Quote, quotesPerPage int, user *arn.User) #load-more-target.quotes QuotesScrollable(quotes, user) - if len(quotes) == quotesPerPage + if loadMoreIndex != 0 .buttons - LoadMore(quotesPerPage) + LoadMore(loadMoreIndex) component QuotesScrollable(quotes []*arn.Quote, user *arn.User) each quote in quotes diff --git a/pages/quotes/quotes.scarlet b/pages/quotes/quotes.scarlet index b24ee551..8fee95e1 100644 --- a/pages/quotes/quotes.scarlet +++ b/pages/quotes/quotes.scarlet @@ -12,25 +12,14 @@ vertical ui-element border-left 5px solid quote-side-border-color !important - overflow hidden box-shadow shadow-light - align-items stretch - align-content stretch .quote-character horizontal align-self flex-end align-items baseline justify-content space-around - padding 0 1em 1em 0 - - span - opacity 0.65 - - a - display inline - margin-left 0.5em - + margin 0 1em 1em 0 .quote-footer text-align center @@ -45,8 +34,6 @@ height 100% display flex flex-grow 1 - align-items stretch - align-content stretch blockquote flex-grow 1 @@ -76,7 +63,6 @@ blockquote margin-left 0.25em vertical-align -0.4em - .character margin 0.5em 0 0 0.5em !important display block !important \ No newline at end of file