Threaded comments
This commit is contained in:
@ -8,6 +8,6 @@ component ActivityFeed(entries []*arn.EditLogEntry, user *arn.User)
|
||||
|
||||
component ActivityPost(post arn.Postable, user *arn.User)
|
||||
if post.Parent() != nil
|
||||
Postable(post, user, fmt.Sprintf(`<p class="activity-header"><a href="%s">%s</a></p>`, post.Parent().Link(), html.EscapeString(post.Parent().TitleByUser(user))), "")
|
||||
Postable(post, user, false, fmt.Sprintf(`<p class="activity-header"><a href="%s">%s</a></p>`, post.Parent().Link(), html.EscapeString(post.Parent().TitleByUser(user))), "")
|
||||
else
|
||||
Postable(post, user, fmt.Sprintf(`<p class="activity-header"><a href="%s">%s</a></p>`, post.Link(), html.EscapeString(post.TitleByUser(user))), "")
|
||||
Postable(post, user, false, fmt.Sprintf(`<p class="activity-header"><a href="%s">%s</a></p>`, post.Link(), html.EscapeString(post.TitleByUser(user))), "")
|
13
pages/post/newpostarea.go
Normal file
13
pages/post/newpostarea.go
Normal file
@ -0,0 +1,13 @@
|
||||
package post
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// NewPostArea renders a new post area.
|
||||
func NewPostArea(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
return ctx.HTML(components.NewPostArea(user, "Reply"))
|
||||
}
|
@ -14,8 +14,6 @@ func Get(ctx *aero.Context) string {
|
||||
id := ctx.Get("id")
|
||||
user := utils.GetUser(ctx)
|
||||
post, err := arn.GetPost(id)
|
||||
// a := 0
|
||||
// a++
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusNotFound, "Post not found", err)
|
||||
|
@ -1,7 +1,7 @@
|
||||
component Post(post *arn.Post, user *arn.User)
|
||||
.thread
|
||||
.posts
|
||||
Postable(post, user, "", "")
|
||||
Postable(post, user, true, "", "")
|
||||
|
||||
.side-note-container.mountable
|
||||
a.side-note(href=post.Parent().Link())= post.Parent().TitleByUser(user)
|
||||
|
@ -21,11 +21,5 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Thread not found", err)
|
||||
}
|
||||
|
||||
// Fetch posts
|
||||
posts := thread.Posts()
|
||||
|
||||
// Sort posts
|
||||
arn.SortPostsLatestLast(posts)
|
||||
|
||||
return ctx.HTML(components.Thread(thread, posts, user))
|
||||
return ctx.HTML(components.Thread(thread, user))
|
||||
}
|
||||
|
@ -1,12 +1,9 @@
|
||||
component Thread(thread *arn.Thread, posts []*arn.Post, user *arn.User)
|
||||
component Thread(thread *arn.Thread, user *arn.User)
|
||||
h1.thread-title= thread.Title
|
||||
|
||||
#thread.thread(data-id=thread.ID)
|
||||
.posts
|
||||
Postable(thread, user, "", thread.Creator().ID)
|
||||
|
||||
each post in posts
|
||||
Postable(post, user, "", thread.Creator().ID)
|
||||
Postable(thread, user, true, "", thread.Creator().ID)
|
||||
|
||||
//- Reply
|
||||
if user != nil
|
||||
|
@ -14,18 +14,23 @@
|
||||
.post-author
|
||||
margin-bottom 0.25rem
|
||||
|
||||
.post-content
|
||||
[data-highlight="true"]
|
||||
.post-content
|
||||
border 2px solid post-highlight-color
|
||||
border 2px solid post-highlight-color
|
||||
|
||||
// [data-pro="true"]
|
||||
// .post-content
|
||||
// border 2px solid pro-color
|
||||
.post-parent
|
||||
vertical
|
||||
|
||||
.replies
|
||||
margin-top 0.75rem
|
||||
margin-left content-padding
|
||||
|
||||
> 600px
|
||||
.post
|
||||
horizontal
|
||||
margin-bottom 0.75rem
|
||||
margin-bottom 0
|
||||
|
||||
.post-author
|
||||
margin-bottom 0
|
||||
margin-bottom 0
|
||||
|
||||
.post-parent
|
||||
horizontal
|
Reference in New Issue
Block a user