2017-11-18 10:28:53 +00:00
|
|
|
package company
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/aerogo/aero"
|
|
|
|
"github.com/animenotifier/arn"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
2017-11-18 10:46:17 +00:00
|
|
|
"github.com/animenotifier/notify.moe/utils"
|
2017-11-18 10:28:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Get company.
|
|
|
|
func Get(ctx *aero.Context) string {
|
2017-11-18 10:46:17 +00:00
|
|
|
user := utils.GetUser(ctx)
|
2017-11-18 10:28:53 +00:00
|
|
|
id := ctx.Get("id")
|
|
|
|
company, err := arn.GetCompany(id)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return ctx.Error(http.StatusNotFound, "Company not found", err)
|
|
|
|
}
|
|
|
|
|
2017-11-18 23:34:03 +00: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 10:46:17 +00:00
|
|
|
return ctx.HTML(components.CompanyPage(company, user))
|
2017-11-18 10:28:53 +00:00
|
|
|
}
|