commit
3b5d87ad0d
@ -9,6 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const maxPosts = 5
|
const maxPosts = 5
|
||||||
|
const maxFollowing = 5
|
||||||
|
|
||||||
// Get dashboard.
|
// Get dashboard.
|
||||||
func Get(ctx *aero.Context) string {
|
func Get(ctx *aero.Context) string {
|
||||||
@ -30,5 +31,19 @@ func Get(ctx *aero.Context) string {
|
|||||||
posts = posts[:maxPosts]
|
posts = posts[:maxPosts]
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.Dashboard(posts))
|
followIDList := user.Following
|
||||||
|
|
||||||
|
if len(followIDList) > maxFollowing {
|
||||||
|
followIDList = followIDList[:maxFollowing]
|
||||||
|
}
|
||||||
|
|
||||||
|
userList, err := arn.DB.GetMany("User", followIDList)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Error(500, "Error fetching followed users", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
followingList := userList.([]*arn.User)
|
||||||
|
|
||||||
|
return ctx.HTML(components.Dashboard(posts, followingList))
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
component Dashboard(posts []*arn.Post)
|
component Dashboard(posts []*arn.Post, following []*arn.User)
|
||||||
h2.page-title Dash
|
h2.page-title Dash
|
||||||
|
|
||||||
.widgets
|
.widgets
|
||||||
@ -38,14 +38,15 @@ component Dashboard(posts []*arn.Post)
|
|||||||
Icon("comment")
|
Icon("comment")
|
||||||
span ...
|
span ...
|
||||||
|
|
||||||
|
if len(following) > 0
|
||||||
.widget.mountable
|
.widget.mountable
|
||||||
h3.widget-title Contacts
|
h3.widget-title Contacts
|
||||||
|
|
||||||
for i := 1; i <= 5; i++
|
each user in following
|
||||||
.widget-element
|
a.widget-element.ajax(href="/+" + user.Nick)
|
||||||
.widget-element-text
|
.widget-element-text
|
||||||
Icon("address-card")
|
Icon("address-card")
|
||||||
span ...
|
span= user.Nick
|
||||||
|
|
||||||
.widget.mountable
|
.widget.mountable
|
||||||
h3.widget-title Follow
|
h3.widget-title Follow
|
||||||
|
Loading…
Reference in New Issue
Block a user