Posts and threads as sub-pages of forum on user profiles

This commit is contained in:
Eduard Urbach 2017-11-17 11:00:49 +01:00
parent 3dc9a2e7bf
commit 900148b788
5 changed files with 18 additions and 8 deletions

View File

@ -115,8 +115,8 @@ func Configure(app *aero.Application) {
// User profiles // User profiles
l.Page("/user", user.Get) l.Page("/user", user.Get)
l.Page("/user/:nick", profile.Get) l.Page("/user/:nick", profile.Get)
l.Page("/user/:nick/threads", profile.GetThreadsByUser) l.Page("/user/:nick/forum/threads", profile.GetThreadsByUser)
l.Page("/user/:nick/posts", profile.GetPostsByUser) l.Page("/user/:nick/forum/posts", profile.GetPostsByUser)
l.Page("/user/:nick/soundtracks", profile.GetSoundTracksByUser) l.Page("/user/:nick/soundtracks", profile.GetSoundTracksByUser)
l.Page("/user/:nick/stats", profile.GetStatsByUser) l.Page("/user/:nick/stats", profile.GetStatsByUser)
l.Page("/user/:nick/followers", profile.GetFollowers) l.Page("/user/:nick/followers", profile.GetFollowers)

View File

@ -1,5 +1,11 @@
component ProfileForumTabs(viewUser *arn.User)
.tabs
Tab("Threads", "list", "/+" + viewUser.Nick + "/forum/threads")
Tab("Posts", "comments", "/+" + viewUser.Nick + "/forum/posts")
component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.User, uri string) component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) ProfileHeader(viewUser, user, uri)
ProfileForumTabs(viewUser)
if len(postables) > 0 if len(postables) > 0
h1.page-title= len(postables), " latest posts by ", postables[0].Author().Nick h1.page-title= len(postables), " latest posts by ", postables[0].Author().Nick

View File

@ -21,8 +21,7 @@ component ProfileTabs(viewUser *arn.User, uri string)
.tabs .tabs
Tab("Anime", "th", "/+" + viewUser.Nick) Tab("Anime", "th", "/+" + viewUser.Nick)
Tab("Collection", "list", "/+" + viewUser.Nick + "/animelist/watching") Tab("Collection", "list", "/+" + viewUser.Nick + "/animelist/watching")
Tab("Threads", "comment", "/+" + viewUser.Nick + "/threads") Tab("Forum", "comment", "/+" + viewUser.Nick + "/forum/threads")
Tab("Posts", "comments", "/+" + viewUser.Nick + "/posts")
Tab("Tracks", "music", "/+" + viewUser.Nick + "/soundtracks") Tab("Tracks", "music", "/+" + viewUser.Nick + "/soundtracks")
Tab("Stats", "area-chart", "/+" + viewUser.Nick + "/stats") Tab("Stats", "area-chart", "/+" + viewUser.Nick + "/stats")
Tab("Followers", "users", "/+" + viewUser.Nick + "/followers") Tab("Followers", "users", "/+" + viewUser.Nick + "/followers")

View File

@ -1,5 +1,6 @@
component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User, uri string) component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User, uri string)
ProfileHeader(viewUser, user, uri) ProfileHeader(viewUser, user, uri)
ProfileForumTabs(viewUser)
if len(threads) == 0 if len(threads) == 0
p.no-data.mountable= viewUser.Nick + " hasn't written any threads yet." p.no-data.mountable= viewUser.Nick + " hasn't written any threads yet."

View File

@ -6,12 +6,12 @@ var routeTests = map[string][]string{
"/+Akyoto", "/+Akyoto",
}, },
"/user/:nick/threads": []string{ "/user/:nick/forum/threads": []string{
"/+Akyoto/threads", "/+Akyoto/forum/threads",
}, },
"/user/:nick/posts": []string{ "/user/:nick/forum/posts": []string{
"/+Akyoto/posts", "/+Akyoto/forum/posts",
}, },
"/user/:nick/soundtracks": []string{ "/user/:nick/soundtracks": []string{
@ -107,6 +107,10 @@ var routeTests = map[string][]string{
"/compare/animelist/Akyoto/Scott", "/compare/animelist/Akyoto/Scott",
}, },
"/explore/anime/:year/:status/:type": []string{
"/explore/anime/2011/finished/tv",
},
// API // API
"/api/anime/:id": []string{ "/api/anime/:id": []string{
"/api/anime/1", "/api/anime/1",