Started company editing UI
This commit is contained in:
@ -19,5 +19,14 @@ func Get(ctx *aero.Context) string {
|
|||||||
return ctx.Error(http.StatusNotFound, "Company not found", err)
|
return ctx.Error(http.StatusNotFound, "Company not found", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.CompanyPage(company, user))
|
return ctx.HTML(components.CompanyPage(company, user))
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,7 @@
|
|||||||
component CompanyPage(company *arn.Company, user *arn.User)
|
component CompanyPage(company *arn.Company, user *arn.User)
|
||||||
h1= company.Name.English
|
h1= company.Name.English
|
||||||
|
|
||||||
|
component CompanyTabs(company *arn.Company, user *arn.User)
|
||||||
|
.tabs
|
||||||
|
Tab("Company", "building", company.Link())
|
||||||
|
Tab("Edit", "pencil", company.Link() + "/edit")
|
33
pages/company/edit.go
Normal file
33
pages/company/edit.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package company
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/aerogo/aero"
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
"github.com/animenotifier/notify.moe/components"
|
||||||
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
|
"github.com/animenotifier/notify.moe/utils/editform"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Edit track.
|
||||||
|
func Edit(ctx *aero.Context) string {
|
||||||
|
id := ctx.Get("id")
|
||||||
|
company, err := arn.GetCompany(id)
|
||||||
|
user := utils.GetUser(ctx)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Error(http.StatusNotFound, "Company not found", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctx.HTML(components.CompanyTabs(company, user) + editform.Render(company, "Edit company", user))
|
||||||
|
}
|
Reference in New Issue
Block a user