commit
d52fe46e9a
@ -1,16 +1,18 @@
|
|||||||
component PostableList(postables []arn.Postable)
|
component PostableList(postables []arn.Postable)
|
||||||
h2.thread-title= len(postables), " latest posts by ", postables[0].Author().Nick
|
|
||||||
.thread
|
.thread
|
||||||
.posts
|
.posts
|
||||||
each post in postables
|
each post in postables
|
||||||
.post
|
.post
|
||||||
.post-author
|
.post-author
|
||||||
Avatar(post.Author())
|
Avatar(post.Author())
|
||||||
|
|
||||||
.post-content
|
.post-content
|
||||||
p!= aero.Markdown(post.Text())
|
p!= aero.Markdown(post.Text())
|
||||||
|
|
||||||
.post-toolbar
|
.post-toolbar
|
||||||
.spacer
|
.spacer
|
||||||
.post-likes= len(post.Likes())
|
.post-likes= len(post.Likes())
|
||||||
a.post-tool.post-permalink.ajax(href=post.Link(), title="Permalink")
|
a.post-tool.post-permalink.ajax(href=post.Link(), title="Permalink")
|
||||||
Icon("link")
|
Icon("link")
|
||||||
|
|
||||||
a.post-link.side-note.ajax(href=post.Link())= post.Title()
|
a.post-link.side-note.ajax(href=post.Link())= post.Title()
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
const postLimit = 10
|
const postLimit = 10
|
||||||
|
|
||||||
// GetPostsbyUser shows all forum posts of a particular user.
|
// GetPostsByUser shows all forum posts of a particular user.
|
||||||
func GetPostsByUser(ctx *aero.Context) string {
|
func GetPostsByUser(ctx *aero.Context) string {
|
||||||
nick := ctx.Get("nick")
|
nick := ctx.Get("nick")
|
||||||
user, err := arn.GetUserByNick(nick)
|
user, err := arn.GetUserByNick(nick)
|
||||||
@ -20,7 +20,7 @@ func GetPostsByUser(ctx *aero.Context) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
posts := user.Posts()
|
posts := user.Posts()
|
||||||
arn.SortPostsLatestLast(posts)
|
arn.SortPostsLatestFirst(posts)
|
||||||
|
|
||||||
var postables []arn.Postable
|
var postables []arn.Postable
|
||||||
|
|
||||||
@ -31,11 +31,9 @@ func GetPostsByUser(ctx *aero.Context) string {
|
|||||||
postables = make([]arn.Postable, len(posts), len(posts))
|
postables = make([]arn.Postable, len(posts), len(posts))
|
||||||
|
|
||||||
for i, post := range posts {
|
for i, post := range posts {
|
||||||
|
|
||||||
postables[i] = arn.ToPostable(post)
|
postables[i] = arn.ToPostable(post)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.PostableList(postables))
|
return ctx.HTML(components.LatestPosts(postables, user))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
6
pages/profile/posts.pixy
Normal file
6
pages/profile/posts.pixy
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
component LatestPosts(postables []arn.Postable, viewUser *arn.User)
|
||||||
|
if len(postables) > 0
|
||||||
|
h2.thread-title= len(postables), " latest posts by ", postables[0].Author().Nick
|
||||||
|
PostableList(postables)
|
||||||
|
else
|
||||||
|
p= viewUser.Nick + " hasn't written any posts yet."
|
@ -42,6 +42,7 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
|||||||
}
|
}
|
||||||
}, func() {
|
}, func() {
|
||||||
posts = viewUser.Posts()
|
posts = viewUser.Posts()
|
||||||
|
arn.SortPostsLatestFirst(posts)
|
||||||
|
|
||||||
if len(posts) > maxPosts {
|
if len(posts) > maxPosts {
|
||||||
posts = posts[:maxPosts]
|
posts = posts[:maxPosts]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user