Threaded comments (Reply UI)

This commit is contained in:
2018-11-05 20:57:37 +09:00
parent 08497f0c37
commit 960b1e4b92
14 changed files with 133 additions and 46 deletions

23
pages/thread/reply-ui.go Normal file
View File

@ -0,0 +1,23 @@
package thread
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// ReplyUI renders a new post area.
func ReplyUI(ctx *aero.Context) string {
id := ctx.Get("id")
user := utils.GetUser(ctx)
thread, err := arn.GetThread(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Thread not found", err)
}
return ctx.HTML(components.NewPostArea(user, "Reply") + components.NewPostActions(thread.Type(), thread.ID))
}

View File

@ -15,9 +15,7 @@ component Thread(thread *arn.Thread, user *arn.User)
.buttons
if !thread.Locked
button.mountable.action(data-action="createPost", data-trigger="click", data-parent-type="Thread", data-parent-id=thread.ID)
Icon("mail-reply")
span Reply
NewPostActions("Thread", thread.ID)
if user.Role == "admin" || user.Role == "editor"
if thread.Locked

View File

@ -11,6 +11,9 @@
vertical
margin-bottom 1.75rem
:last-child
margin-bottom 0
.post-author
margin-bottom 0.25rem
@ -25,9 +28,12 @@
margin-top 0.75rem
margin-left content-padding
:empty
margin-top 0
> 600px
.post
margin-bottom 0
margin-bottom 0.75rem
.post-author
margin-bottom 0