Improved user profiles
This commit is contained in:
parent
dd974ed99a
commit
4f6ffd969d
@ -4,7 +4,7 @@ component AnimeLists(animeLists map[string]*arn.AnimeList, viewUser *arn.User, u
|
|||||||
h2.page-title.anime-list-owner= viewUser.Nick + "'s collection"
|
h2.page-title.anime-list-owner= viewUser.Nick + "'s collection"
|
||||||
|
|
||||||
if len(animeLists[arn.AnimeListStatusWatching].Items) == 0 && len(animeLists[arn.AnimeListStatusCompleted].Items) == 0 && len(animeLists[arn.AnimeListStatusPlanned].Items) == 0 && len(animeLists[arn.AnimeListStatusHold].Items) == 0 && len(animeLists[arn.AnimeListStatusDropped].Items) == 0
|
if len(animeLists[arn.AnimeListStatusWatching].Items) == 0 && len(animeLists[arn.AnimeListStatusCompleted].Items) == 0 && len(animeLists[arn.AnimeListStatusPlanned].Items) == 0 && len(animeLists[arn.AnimeListStatusHold].Items) == 0 && len(animeLists[arn.AnimeListStatusDropped].Items) == 0
|
||||||
p.no-data No anime in the collection.
|
p.no-data.mountable= viewUser.Nick + " hasn't added any anime yet."
|
||||||
else
|
else
|
||||||
if len(animeLists[arn.AnimeListStatusWatching].Items) > 0
|
if len(animeLists[arn.AnimeListStatusWatching].Items) > 0
|
||||||
.anime-list-container
|
.anime-list-container
|
||||||
|
@ -4,7 +4,6 @@ component Forum(tag string, threads []*arn.Thread, threadsPerPage int)
|
|||||||
.forum
|
.forum
|
||||||
ThreadList(threads)
|
ThreadList(threads)
|
||||||
|
|
||||||
|
|
||||||
.buttons
|
.buttons
|
||||||
button#new-thread.action(data-action="load", data-trigger="click", data-url="/new/thread")
|
button#new-thread.action(data-action="load", data-trigger="click", data-url="/new/thread")
|
||||||
Icon("plus")
|
Icon("plus")
|
||||||
@ -16,7 +15,7 @@ component Forum(tag string, threads []*arn.Thread, threadsPerPage int)
|
|||||||
|
|
||||||
component ThreadList(threads []*arn.Thread)
|
component ThreadList(threads []*arn.Thread)
|
||||||
if len(threads) == 0
|
if len(threads) == 0
|
||||||
p.no-data No threads found.
|
p.no-data.mountable No threads found.
|
||||||
else
|
else
|
||||||
each thread in threads
|
each thread in threads
|
||||||
ThreadLink(thread)
|
ThreadLink(thread)
|
@ -5,4 +5,4 @@ component LatestPosts(postables []arn.Postable, viewUser *arn.User, user *arn.Us
|
|||||||
h2.page-title= len(postables), " latest posts by ", postables[0].Author().Nick
|
h2.page-title= len(postables), " latest posts by ", postables[0].Author().Nick
|
||||||
PostableList(postables)
|
PostableList(postables)
|
||||||
else
|
else
|
||||||
p= viewUser.Nick + " hasn't written any posts yet."
|
p.no-data.mountable= viewUser.Nick + " hasn't written any posts yet."
|
@ -54,7 +54,7 @@ component ProfileNavigation(viewUser *arn.User)
|
|||||||
|
|
||||||
a.button.tab.action(href="/+" + viewUser.Nick + "/animelist", data-action="diff", data-trigger="click")
|
a.button.tab.action(href="/+" + viewUser.Nick + "/animelist", data-action="diff", data-trigger="click")
|
||||||
Icon("list")
|
Icon("list")
|
||||||
span.tab-text List
|
span.tab-text Collection
|
||||||
|
|
||||||
a.button.tab.action(href="/+" + viewUser.Nick + "/threads", data-action="diff", data-trigger="click")
|
a.button.tab.action(href="/+" + viewUser.Nick + "/threads", data-action="diff", data-trigger="click")
|
||||||
Icon("comment")
|
Icon("comment")
|
||||||
@ -71,10 +71,10 @@ component ProfileNavigation(viewUser *arn.User)
|
|||||||
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack)
|
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack)
|
||||||
ProfileHeader(viewUser, user)
|
ProfileHeader(viewUser, user)
|
||||||
|
|
||||||
.profile-watching-list.mountable
|
if len(animeList.Items) == 0
|
||||||
if len(animeList.Items) == 0
|
p.no-data.mountable= viewUser.Nick + " hasn't added any anime yet."
|
||||||
p.no-data No anime in the collection.
|
else
|
||||||
else
|
.profile-watching-list.mountable
|
||||||
each item in animeList.Items
|
each item in animeList.Items
|
||||||
a.profile-watching-list-item.ajax(href=item.Anime().Link(), title=item.Anime().Title.Canonical + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
|
a.profile-watching-list-item.ajax(href=item.Anime().Link(), title=item.Anime().Title.Canonical + " (" + toString(item.Episodes) + " / " + arn.EpisodesToString(item.Anime().EpisodeCount) + ")")
|
||||||
img.anime-cover-image.profile-watching-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical)
|
img.anime-cover-image.profile-watching-list-item-image.lazy(data-src=item.Anime().Image.Tiny, alt=item.Anime().Title.Canonical)
|
||||||
|
@ -86,6 +86,9 @@ profile-boot-duration = 2s
|
|||||||
#nick
|
#nick
|
||||||
margin-bottom 1rem
|
margin-bottom 1rem
|
||||||
|
|
||||||
|
.no-data
|
||||||
|
text-align center
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
|
|
||||||
// .profile-category
|
// .profile-category
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
"github.com/animenotifier/notify.moe/utils"
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const maxThreads = 20
|
||||||
|
|
||||||
// GetThreadsByUser shows all forum threads of a particular user.
|
// GetThreadsByUser shows all forum threads of a particular user.
|
||||||
func GetThreadsByUser(ctx *aero.Context) string {
|
func GetThreadsByUser(ctx *aero.Context) string {
|
||||||
nick := ctx.Get("nick")
|
nick := ctx.Get("nick")
|
||||||
@ -21,5 +23,9 @@ func GetThreadsByUser(ctx *aero.Context) string {
|
|||||||
threads := viewUser.Threads()
|
threads := viewUser.Threads()
|
||||||
arn.SortThreadsLatestFirst(threads)
|
arn.SortThreadsLatestFirst(threads)
|
||||||
|
|
||||||
|
if len(threads) > maxThreads {
|
||||||
|
threads = threads[:maxThreads]
|
||||||
|
}
|
||||||
|
|
||||||
return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx)))
|
return ctx.HTML(components.ProfileThreads(threads, viewUser, utils.GetUser(ctx)))
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User)
|
component ProfileThreads(threads []*arn.Thread, viewUser *arn.User, user *arn.User)
|
||||||
ProfileHeader(viewUser, user)
|
ProfileHeader(viewUser, user)
|
||||||
|
|
||||||
.forum
|
if len(threads) == 0
|
||||||
ThreadList(threads)
|
p.no-data.mountable= viewUser.Nick + " hasn't written any threads yet."
|
||||||
|
else
|
||||||
|
.forum
|
||||||
|
ThreadList(threads)
|
||||||
|
@ -4,7 +4,7 @@ component TrackList(tracks []*arn.SoundTrack, viewUser *arn.User, user *arn.User
|
|||||||
h2.page-title= "Tracks added by " + viewUser.Nick
|
h2.page-title= "Tracks added by " + viewUser.Nick
|
||||||
|
|
||||||
if len(tracks) == 0
|
if len(tracks) == 0
|
||||||
p.no-data No tracks added.
|
p.no-data.mountable= viewUser.Nick + " hasn't added any tracks yet."
|
||||||
else
|
else
|
||||||
.sound-tracks
|
.sound-tracks
|
||||||
each track in tracks
|
each track in tracks
|
||||||
|
@ -4,7 +4,7 @@ component SearchResults(users []*arn.User, animeResults []*arn.Anime)
|
|||||||
h3 Users
|
h3 Users
|
||||||
.user-avatars.user-search
|
.user-avatars.user-search
|
||||||
if len(users) == 0
|
if len(users) == 0
|
||||||
p.no-data No users found.
|
p.no-data.mountable No users found.
|
||||||
else
|
else
|
||||||
each user in users
|
each user in users
|
||||||
.mountable(data-mountable-type="user")
|
.mountable(data-mountable-type="user")
|
||||||
@ -15,7 +15,7 @@ component SearchResults(users []*arn.User, animeResults []*arn.Anime)
|
|||||||
h3 Anime
|
h3 Anime
|
||||||
.profile-watching-list.anime-search
|
.profile-watching-list.anime-search
|
||||||
if len(animeResults) == 0
|
if len(animeResults) == 0
|
||||||
p.no-data No anime found.
|
p.no-data.mountable No anime found.
|
||||||
else
|
else
|
||||||
each anime in animeResults
|
each anime in animeResults
|
||||||
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
|
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
|
||||||
|
Loading…
Reference in New Issue
Block a user