notify.moe/pages/company/company.go

33 lines
723 B
Go
Raw Normal View History

2017-11-18 11:28:53 +01:00
package company
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
2017-11-18 11:46:17 +01:00
"github.com/animenotifier/notify.moe/utils"
2017-11-18 11:28:53 +01:00
)
// Get company.
func Get(ctx *aero.Context) string {
2017-11-18 11:46:17 +01:00
user := utils.GetUser(ctx)
2017-11-18 11:28:53 +01:00
id := ctx.Get("id")
company, err := arn.GetCompany(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Company not found", err)
}
2017-11-19 00:34:03 +01:00
ctx.Data = &arn.OpenGraph{
Tags: map[string]string{
"og:title": company.Name.English,
"og:url": "https://" + ctx.App.Config.Domain + company.Link(),
"og:site_name": "notify.moe",
"og:image": company.Image,
},
}
2017-11-18 11:46:17 +01:00
return ctx.HTML(components.CompanyPage(company, user))
2017-11-18 11:28:53 +01:00
}