From 20ec5e77f564058916619e1a09a040285c38673a Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 25 Feb 2018 19:22:59 +0100 Subject: [PATCH] Added Japanese text for quotes --- mixins/Quote.pixy | 3 +-- pages/quote/edit.go | 2 +- pages/quote/quote.go | 2 +- pages/quotes/best.go | 10 +++++++--- pages/quotes/quotes.go | 6 +++--- pages/quotes/quotes.scarlet | 2 -- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mixins/Quote.pixy b/mixins/Quote.pixy index cae68b94..317d0a68 100644 --- a/mixins/Quote.pixy +++ b/mixins/Quote.pixy @@ -7,8 +7,7 @@ component QuoteContent(quote *arn.Quote) .quote-content a.quotation.ajax(href=quote.Link()) blockquote - p - q= quote.Description + p= quote.Text.English if quote.CharacterID != "" && quote.Character() != nil footer.quote-character diff --git a/pages/quote/edit.go b/pages/quote/edit.go index ad1f521b..b4f0d9e0 100644 --- a/pages/quote/edit.go +++ b/pages/quote/edit.go @@ -22,7 +22,7 @@ func Edit(ctx *aero.Context) string { ctx.Data = &arn.OpenGraph{ Tags: map[string]string{ - "og:title": quote.Description, + "og:title": quote.Text.English, "og:url": "https://" + ctx.App.Config.Domain + quote.Link(), "og:site_name": "notify.moe", }, diff --git a/pages/quote/quote.go b/pages/quote/quote.go index 370eef03..f963fdcf 100644 --- a/pages/quote/quote.go +++ b/pages/quote/quote.go @@ -22,7 +22,7 @@ func Get(ctx *aero.Context) string { openGraph := &arn.OpenGraph{ Tags: map[string]string{ "og:title": "Quote", - "og:description": quote.Description, + "og:description": quote.Text.English, "og:url": "https://" + ctx.App.Config.Domain + quote.Link(), "og:site_name": "notify.moe", "og:type": "article", diff --git a/pages/quotes/best.go b/pages/quotes/best.go index e86df8ea..4ed46a77 100644 --- a/pages/quotes/best.go +++ b/pages/quotes/best.go @@ -15,16 +15,20 @@ func Best(ctx *aero.Context) string { user := utils.GetUser(ctx) quotes := arn.FilterQuotes(func(track *arn.Quote) bool { - return !track.IsDraft && len(track.Description) > 0 + return !track.IsDraft && len(track.Text.English) > 0 }) arn.SortQuotesPopularFirst(quotes) + // Limit 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)) } // BestFrom renders the quotes from the given index. @@ -37,7 +41,7 @@ func BestFrom(ctx *aero.Context) string { } allQuotes := arn.FilterQuotes(func(track *arn.Quote) bool { - return !track.IsDraft && len(track.Description) > 0 + return !track.IsDraft && len(track.Text.English) > 0 }) if index < 0 || index >= len(allQuotes) { diff --git a/pages/quotes/quotes.go b/pages/quotes/quotes.go index 14487efa..e53d8322 100644 --- a/pages/quotes/quotes.go +++ b/pages/quotes/quotes.go @@ -17,12 +17,12 @@ func Latest(ctx *aero.Context) string { user := utils.GetUser(ctx) quotes := arn.FilterQuotes(func(track *arn.Quote) bool { - return !track.IsDraft && len(track.Description) > 0 + return !track.IsDraft && len(track.Text.English) > 0 }) arn.SortQuotesLatestFirst(quotes) - // Reduce the number of displayed quotes + // Limit the number of displayed quotes loadMoreIndex := 0 if len(quotes) > maxQuotes { @@ -43,7 +43,7 @@ func LatestFrom(ctx *aero.Context) string { } allQuotes := arn.FilterQuotes(func(track *arn.Quote) bool { - return !track.IsDraft && len(track.Description) > 0 + return !track.IsDraft && len(track.Text.English) > 0 }) if index < 0 || index >= len(allQuotes) { diff --git a/pages/quotes/quotes.scarlet b/pages/quotes/quotes.scarlet index 8fee95e1..91f7a62d 100644 --- a/pages/quotes/quotes.scarlet +++ b/pages/quotes/quotes.scarlet @@ -41,8 +41,6 @@ blockquote p line-height 2em - - q quotes "\201C""\201D" color text-color text-shadow none