Started main quote with bool types for EditForm.

This commit is contained in:
Scott 2018-04-10 14:17:10 +02:00
parent b1580348a9
commit b9b164eb89
4 changed files with 15 additions and 4 deletions

View File

@ -37,7 +37,14 @@ func Get(ctx *aero.Context) string {
}) })
// Quotes // Quotes
var mainQuote *arn.Quote
quotes := character.Quotes() quotes := character.Quotes()
for i, quote := range quotes {
if quote.IsMainQuote {
mainQuote = quote
quotes = append(quotes[:i], quotes[i+1:]...)
}
}
arn.SortQuotesPopularFirst(quotes) arn.SortQuotesPopularFirst(quotes)
// Set OpenGraph attributes // Set OpenGraph attributes
@ -65,5 +72,5 @@ func Get(ctx *aero.Context) string {
}, },
} }
return ctx.HTML(components.CharacterDetails(character, characterAnime, quotes, user)) return ctx.HTML(components.CharacterDetails(character, characterAnime, quotes, mainQuote, user))
} }

View File

@ -1,4 +1,4 @@
component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime, quotes []*arn.Quote, user *arn.User) component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime, quotes []*arn.Quote, mainQuote *arn.Quote, user *arn.User)
.character-page .character-page
.character-left-column .character-left-column
.character-header .character-header
@ -13,7 +13,9 @@ component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime
Japanese(character.Name.Japanese) Japanese(character.Name.Japanese)
else else
Japanese("日本語の名前無し") Japanese("日本語の名前無し")
if mainQuote != nil
.character-main-quote
Quote(mainQuote)
.character-description.mountable!= markdown.Render(character.Description) .character-description.mountable!= markdown.Render(character.Description)
h3.mountable Anime h3.mountable Anime

View File

@ -45,7 +45,8 @@
.character-quotes .character-quotes
vertical vertical
.character-quote .character-quote,
.character-main-quote
footer, footer,
.quote-footer .quote-footer
display none display none

View File

@ -201,6 +201,7 @@ func RenderField(b *bytes.Buffer, v *reflect.Value, field reflect.StructField, i
} }
// TODO: Render bool type // TODO: Render bool type
b.WriteString(components.InputBool(idPrefix+field.Name, fieldValue.Bool(), field.Name, field.Tag.Get("tooltip")))
return return
} }