Quotes cleanup

This commit is contained in:
Eduard Urbach 2018-02-25 17:06:47 +01:00
parent fd9f25a0f3
commit dddb066b0d
6 changed files with 20 additions and 29 deletions

View File

@ -1,5 +1,5 @@
component Quote(quote *arn.Quote) component Quote(quote *arn.Quote)
.quote.mountable(id=quote.ID) .quote.mountable
QuoteContent(quote) QuoteContent(quote)
QuoteFooter(quote) QuoteFooter(quote)
@ -19,4 +19,4 @@ component QuoteFooter(quote *arn.Quote)
span posted span posted
span.utc-date(data-date=quote.Created) span.utc-date(data-date=quote.Created)
span by span by
a.ajax(href=quote.Creator().Link())= quote.Creator().Nick + " " a.ajax(href=quote.Creator().Link())= quote.Creator().Nick

View File

@ -15,6 +15,7 @@ component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime
each anime in characterAnime each anime in characterAnime
a.character-anime-item.ajax(href=anime.Link(), title=anime.Title.ByUser(user)) 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)) img.character-anime-item-image.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.ByUser(user))
if len(quotes) >0 if len(quotes) >0
h3 Quotes h3 Quotes
.character-quotes .character-quotes

View File

@ -42,13 +42,11 @@
anime-mini-item-image anime-mini-item-image
.character-quotes .character-quotes
horizontal-wrap vertical
justify-content space-around
.character-quote .character-quote
flex-basis 400px footer,
.quote-footer
footer
display none display none
> 1250px > 1250px

View File

@ -1,15 +1,16 @@
package quotes package quotes
import ( import (
"net/http"
"strconv"
"github.com/aerogo/aero" "github.com/aerogo/aero"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils" "github.com/animenotifier/notify.moe/utils"
"net/http"
"strconv"
) )
const maxQuotes = 12 const maxQuotes = 6
// Latest renders the quotes page. // Latest renders the quotes page.
func Latest(ctx *aero.Context) string { func Latest(ctx *aero.Context) string {
@ -21,10 +22,15 @@ func Latest(ctx *aero.Context) string {
arn.SortQuotesLatestFirst(quotes) arn.SortQuotesLatestFirst(quotes)
// Reduce the number of displayed quotes
loadMoreIndex := 0
if len(quotes) > maxQuotes { if len(quotes) > maxQuotes {
quotes = 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. // LatestFrom renders the quotes from the given index.

View File

@ -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 h1.page-title Quotes
QuotesTabs QuotesTabs
@ -17,9 +17,9 @@ component Quotes(quotes []*arn.Quote, quotesPerPage int, user *arn.User)
#load-more-target.quotes #load-more-target.quotes
QuotesScrollable(quotes, user) QuotesScrollable(quotes, user)
if len(quotes) == quotesPerPage if loadMoreIndex != 0
.buttons .buttons
LoadMore(quotesPerPage) LoadMore(loadMoreIndex)
component QuotesScrollable(quotes []*arn.Quote, user *arn.User) component QuotesScrollable(quotes []*arn.Quote, user *arn.User)
each quote in quotes each quote in quotes

View File

@ -12,25 +12,14 @@
vertical vertical
ui-element ui-element
border-left 5px solid quote-side-border-color !important border-left 5px solid quote-side-border-color !important
overflow hidden
box-shadow shadow-light box-shadow shadow-light
align-items stretch
align-content stretch
.quote-character .quote-character
horizontal horizontal
align-self flex-end align-self flex-end
align-items baseline align-items baseline
justify-content space-around justify-content space-around
padding 0 1em 1em 0 margin 0 1em 1em 0
span
opacity 0.65
a
display inline
margin-left 0.5em
.quote-footer .quote-footer
text-align center text-align center
@ -45,8 +34,6 @@
height 100% height 100%
display flex display flex
flex-grow 1 flex-grow 1
align-items stretch
align-content stretch
blockquote blockquote
flex-grow 1 flex-grow 1
@ -76,7 +63,6 @@ blockquote
margin-left 0.25em margin-left 0.25em
vertical-align -0.4em vertical-align -0.4em
.character .character
margin 0.5em 0 0 0.5em !important margin 0.5em 0 0 0.5em !important
display block !important display block !important