Scott c51cb4743b Added the list of quotes sorted by last and best with a correct design.
The design has been verified to be responsive and compatible with the dark theme
2018-02-25 01:36:22 +01:00

40 lines
925 B
Go

package quote
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get company.
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id")
quote, err := arn.GetQuote(id)
if err != nil {
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:description": quote.Description,
"og:url": "https://" + ctx.App.Config.Domain + quote.Link(),
"og:site_name": "notify.moe",
"og:type": "article",
},
}
ctx.Data = openGraph
return ctx.HTML(components.QuotePage(quote, character, user))
}