Added forum post editing

This commit is contained in:
2017-07-06 16:54:10 +02:00
parent 9de86a83f9
commit 5070600964
13 changed files with 139 additions and 78 deletions

View File

@ -6,16 +6,18 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get post.
func Get(ctx *aero.Context) string {
id := ctx.Get("id")
user := utils.GetUser(ctx)
post, err := arn.GetPost(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Post not found", err)
}
return ctx.HTML(components.Post(post))
return ctx.HTML(components.Post(post, user))
}

View File

@ -1,5 +1,5 @@
component Post(post *arn.Post)
Postable(post.ToPostable(), "")
component Post(post *arn.Post, user *arn.User)
Postable(post.ToPostable(), user, "")
.side-note
a.ajax(href=post.Thread().Link())= post.Thread().Title