Added soundtracks to user profiles
This commit is contained in:
parent
9463f1c13b
commit
8727ab63eb
@ -8,6 +8,9 @@ component Music(tracks []*arn.SoundTrack)
|
||||
|
||||
.sound-tracks
|
||||
each track in tracks
|
||||
SoundTrack(track)
|
||||
|
||||
component SoundTrack(track *arn.SoundTrack)
|
||||
.sound-track(id=track.ID)
|
||||
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
|
||||
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
const maxPosts = 5
|
||||
const maxTracks = 5
|
||||
|
||||
// Get user profile page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
@ -27,6 +28,7 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||
var user *arn.User
|
||||
var threads []*arn.Thread
|
||||
var animeList *arn.AnimeList
|
||||
var tracks []*arn.SoundTrack
|
||||
var posts []*arn.Post
|
||||
|
||||
flow.Parallel(func() {
|
||||
@ -48,7 +50,14 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
||||
if len(posts) > maxPosts {
|
||||
posts = posts[:maxPosts]
|
||||
}
|
||||
}, func() {
|
||||
tracks = viewUser.SoundTracks()
|
||||
arn.SortSoundTracksLatestFirst(tracks)
|
||||
|
||||
if len(tracks) > maxTracks {
|
||||
tracks = tracks[:maxTracks]
|
||||
}
|
||||
})
|
||||
|
||||
return ctx.HTML(components.Profile(viewUser, user, animeList, threads, posts))
|
||||
return ctx.HTML(components.Profile(viewUser, user, animeList, threads, posts, tracks))
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ component ProfileHeader(viewUser *arn.User, user *arn.User)
|
||||
Icon("rocket")
|
||||
span= arn.Capitalize(viewUser.Role)
|
||||
|
||||
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post)
|
||||
component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList, threads []*arn.Thread, posts []*arn.Post, tracks []*arn.SoundTrack)
|
||||
ProfileHeader(viewUser, user)
|
||||
|
||||
.profile-category.mountable
|
||||
@ -68,6 +68,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
|
||||
else
|
||||
each thread in threads
|
||||
ThreadLink(thread)
|
||||
|
||||
.profile-category.mountable
|
||||
h3
|
||||
a.ajax(href="/+" + viewUser.Nick + "/posts", title="View all posts") Posts
|
||||
@ -84,6 +85,16 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
|
||||
.spacer
|
||||
.post-likes= len(post.Likes)
|
||||
|
||||
.profile-category.mountable
|
||||
h3 Tracks
|
||||
|
||||
if len(tracks) == 0
|
||||
p No soundtracks posted yet.
|
||||
else
|
||||
.sound-tracks
|
||||
each track in tracks
|
||||
SoundTrack(track)
|
||||
|
||||
//- if user != nil && user.Role == "admin"
|
||||
//- .footer
|
||||
//- a(href="/api/user/" + viewUser.ID) User API
|
Loading…
Reference in New Issue
Block a user