✨ Added basic quote display
This commit is contained in:
39
pages/quote/quote.go
Normal file
39
pages/quote/quote.go
Normal file
@ -0,0 +1,39 @@
|
||||
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.Character)
|
||||
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))
|
||||
}
|
15
pages/quote/quote.pixy
Normal file
15
pages/quote/quote.pixy
Normal file
@ -0,0 +1,15 @@
|
||||
<<<<<<< HEAD
|
||||
component QuotePage(quote *arn.Quote, character *arn.Character, user *arn.User)
|
||||
QuoteTabs(quote, user)
|
||||
|
||||
.quote-page
|
||||
.quote-header
|
||||
h1.quote-name.mountable= quote.Description
|
||||
h3.mountable Characters
|
||||
.quote-character.mountable
|
||||
Character(character)
|
||||
|
||||
component QuoteTabs(quote *arn.Quote, user *arn.User)
|
||||
.tabs
|
||||
Tab("Quote", "building", quote.Link())
|
||||
Tab("Edit", "pencil", quote.Link() + "/edit")
|
Reference in New Issue
Block a user