From 900148b788246460f096307a3df96ac524e4c7ea Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 17 Nov 2017 11:00:49 +0100 Subject: [PATCH] Posts and threads as sub-pages of forum on user profiles --- pages/index.go | 4 ++-- pages/profile/posts.pixy | 6 ++++++ pages/profile/profile.pixy | 3 +-- pages/profile/threads.pixy | 1 + tests.go | 12 ++++++++---- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pages/index.go b/pages/index.go index 07da208e..4d52467c 100644 --- a/pages/index.go +++ b/pages/index.go @@ -115,8 +115,8 @@ func Configure(app *aero.Application) { // User profiles l.Page("/user", user.Get) l.Page("/user/:nick", profile.Get) - l.Page("/user/:nick/threads", profile.GetThreadsByUser) - l.Page("/user/:nick/posts", profile.GetPostsByUser) + l.Page("/user/:nick/forum/threads", profile.GetThreadsByUser) + l.Page("/user/:nick/forum/posts", profile.GetPostsByUser) l.Page("/user/:nick/soundtracks", profile.GetSoundTracksByUser) l.Page("/user/:nick/stats", profile.GetStatsByUser) l.Page("/user/:nick/followers", profile.GetFollowers) diff --git a/pages/profile/posts.pixy b/pages/profile/posts.pixy index d7176bd8..3f8309d5 100644 --- a/pages/profile/posts.pixy +++ b/pages/profile/posts.pixy @@ -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) ProfileHeader(viewUser, user, uri) + ProfileForumTabs(viewUser) if len(postables) > 0 h1.page-title= len(postables), " latest posts by ", postables[0].Author().Nick diff --git a/pages/profile/profile.pixy b/pages/profile/profile.pixy index 01ae8088..090bc2bd 100644 --- a/pages/profile/profile.pixy +++ b/pages/profile/profile.pixy @@ -21,8 +21,7 @@ component ProfileTabs(viewUser *arn.User, uri string) .tabs Tab("Anime", "th", "/+" + viewUser.Nick) Tab("Collection", "list", "/+" + viewUser.Nick + "/animelist/watching") - Tab("Threads", "comment", "/+" + viewUser.Nick + "/threads") - Tab("Posts", "comments", "/+" + viewUser.Nick + "/posts") + Tab("Forum", "comment", "/+" + viewUser.Nick + "/forum/threads") Tab("Tracks", "music", "/+" + viewUser.Nick + "/soundtracks") Tab("Stats", "area-chart", "/+" + viewUser.Nick + "/stats") Tab("Followers", "users", "/+" + viewUser.Nick + "/followers") diff --git a/pages/profile/threads.pixy b/pages/profile/threads.pixy index 2899cd14..81b6c23d 100644 --- a/pages/profile/threads.pixy +++ b/pages/profile/threads.pixy @@ -1,5 +1,6 @@ component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User, uri string) ProfileHeader(viewUser, user, uri) + ProfileForumTabs(viewUser) if len(threads) == 0 p.no-data.mountable= viewUser.Nick + " hasn't written any threads yet." diff --git a/tests.go b/tests.go index 0a27d5bf..01464a23 100644 --- a/tests.go +++ b/tests.go @@ -6,12 +6,12 @@ var routeTests = map[string][]string{ "/+Akyoto", }, - "/user/:nick/threads": []string{ - "/+Akyoto/threads", + "/user/:nick/forum/threads": []string{ + "/+Akyoto/forum/threads", }, - "/user/:nick/posts": []string{ - "/+Akyoto/posts", + "/user/:nick/forum/posts": []string{ + "/+Akyoto/forum/posts", }, "/user/:nick/soundtracks": []string{ @@ -107,6 +107,10 @@ var routeTests = map[string][]string{ "/compare/animelist/Akyoto/Scott", }, + "/explore/anime/:year/:status/:type": []string{ + "/explore/anime/2011/finished/tv", + }, + // API "/api/anime/:id": []string{ "/api/anime/1",