Added the quotes on a character page

This commit is contained in:
Scott 2018-01-25 15:29:52 +01:00
parent 9d41f4dc6e
commit 359a76dfa4
4 changed files with 59 additions and 2 deletions

View File

@ -36,6 +36,13 @@ func Get(ctx *aero.Context) string {
return characterAnime[i].StartDate < characterAnime[j].StartDate
})
// Quotes
quotes := arn.FilterQuotes(func(quote *arn.Quote) bool {
return !quote.IsDraft && len(quote.Description) > 0 && quote.CharacterId == character.ID
})
arn.SortQuotesPopularFirst(quotes)
// Set OpenGraph attributes
description := character.Description
@ -61,5 +68,5 @@ func Get(ctx *aero.Context) string {
},
}
return ctx.HTML(components.CharacterDetails(character, characterAnime, user))
return ctx.HTML(components.CharacterDetails(character, characterAnime, quotes, user))
}

View File

@ -1,4 +1,4 @@
component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime, user *arn.User)
component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime, quotes []*arn.Quote, user *arn.User)
.character-page
.character-left-column
.character-header
@ -15,6 +15,10 @@ 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))
h3 Quotes
.character-quotes
each quote in quotes
Quote(quote)
if len(character.Attributes) > 0
.character-sidebar

View File

@ -41,6 +41,16 @@
.character-anime-item-image
anime-mini-item-image
.character-quotes
horizontal-wrap
justify-content space-around
.quote
flex-basis 400px !important
footer
display none !important
> 1250px
.character-page
horizontal

View File

@ -87,6 +87,30 @@ var routeTests = map[string][]string{
"/search/Dragon Ball",
},
"/quote/:id": []string{
"/quote/-8I3JKykR",
},
"/quote/:id/edit": []string{
"/quote/-8I3JKykR/edit",
},
"/quotes": []string{
"/quotes",
},
"/quotes/best": []string{
"/quotes/best",
},
"/quotes/from/:index": []string{
"/quotes/from/2",
},
"/quotes/best/from/:index": []string{
"/quotes/best/from/2",
},
"/soundtrack/:id": []string{
"/soundtrack/h0ac8sKkg",
},
@ -95,10 +119,22 @@ var routeTests = map[string][]string{
"/soundtrack/h0ac8sKkg/edit",
},
"/soundtracks": []string{
"/soundtracks",
},
"/soundtracks/best": []string{
"/soundtracks/best",
},
"/soundtracks/from/:index": []string{
"/soundtracks/from/12",
},
"/soundtracks/best/from/:index": []string{
"/soundtracks/best/from/12",
},
"/character/:id": []string{
"/character/6556",
},