Improved quote editing

This commit is contained in:
Eduard Urbach 2018-02-25 12:19:27 +01:00
parent c9af3561b8
commit c0f490a959
4 changed files with 13 additions and 11 deletions

View File

@ -9,7 +9,8 @@ component QuoteContent(quote *arn.Quote)
blockquote
p
q= quote.Description
if quote.Character() != nil
if quote.CharacterID != "" && quote.Character() != nil
footer.quote-character
span= "by"
a.ajax(href=quote.Character().Link())= quote.Character().Name

View File

@ -1,5 +1,3 @@
// This should be made abstract for every Likeable so we avoid repeating ourselves but I'm unsure on
// how to do it
component TabLikeQuote(label string, icon string, quote *arn.Quote, user *arn.User)
if user == nil
.tab.action(aria-label=label, title="Login to like this quote")

View File

@ -19,14 +19,9 @@ func Get(ctx *aero.Context) string {
return ctx.Error(http.StatusNotFound, "Quote not found", err)
}
character, err := arn.GetCharacter(quote.CharacterID)
if err != nil {
return ctx.Error(http.StatusNotFound, "Quote not found", err)
}
openGraph := &arn.OpenGraph{
Tags: map[string]string{
"og:title": quote.Description,
"og:title": "Quote",
"og:description": quote.Description,
"og:url": "https://" + ctx.App.Config.Domain + quote.Link(),
"og:site_name": "notify.moe",
@ -34,6 +29,12 @@ func Get(ctx *aero.Context) string {
},
}
character, _ := arn.GetCharacter(quote.CharacterID)
if character != nil {
openGraph.Tags["og:title"] = character.Name + "'s quote"
}
ctx.Data = openGraph
return ctx.HTML(components.QuotePage(quote, character, user))
}

View File

@ -1,5 +1,6 @@
component QuotePage(quote *arn.Quote, character *arn.Character, user *arn.User)
QuoteTabs(quote, user)
.quote-full-page
.quote-main-column
QuoteMainColumn(quote, user)
@ -7,7 +8,7 @@ component QuotePage(quote *arn.Quote, character *arn.Character, user *arn.User)
QuoteSideColumn(quote, user)
component QuoteMainColumn(quote *arn.Quote, user *arn.User)
.widget-form
.widget-form.mountable
QuoteContent(quote)
.footer.mountable
@ -29,8 +30,9 @@ component QuoteSideColumn(quote *arn.Quote, user *arn.User)
component QuoteInformation(quote *arn.Quote, user *arn.User)
section.quote-section.mountable
h3.quote-section-name Information
table.quote-info-table
if quote.Anime() != nil
if quote.AnimeID != "" && quote.Anime() != nil
tr.mountable(data-mountable-type="info")
td.quote-info-key Anime:
td.quote-info-value