Added soundtracks to user profiles
This commit is contained in:
parent
9463f1c13b
commit
8727ab63eb
@ -8,11 +8,14 @@ component Music(tracks []*arn.SoundTrack)
|
|||||||
|
|
||||||
.sound-tracks
|
.sound-tracks
|
||||||
each track in tracks
|
each track in tracks
|
||||||
.sound-track(id=track.ID)
|
SoundTrack(track)
|
||||||
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)
|
component SoundTrack(track *arn.SoundTrack)
|
||||||
|
.sound-track(id=track.ID)
|
||||||
iframe.lazy(data-src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&visual=true")
|
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
|
||||||
.sound-track-footer
|
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
|
||||||
span posted by
|
|
||||||
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick
|
iframe.lazy(data-src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&visual=true")
|
||||||
|
.sound-track-footer
|
||||||
|
span posted by
|
||||||
|
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick
|
@ -9,6 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const maxPosts = 5
|
const maxPosts = 5
|
||||||
|
const maxTracks = 5
|
||||||
|
|
||||||
// Get user profile page.
|
// Get user profile page.
|
||||||
func Get(ctx *aero.Context) string {
|
func Get(ctx *aero.Context) string {
|
||||||
@ -27,6 +28,7 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
|||||||
var user *arn.User
|
var user *arn.User
|
||||||
var threads []*arn.Thread
|
var threads []*arn.Thread
|
||||||
var animeList *arn.AnimeList
|
var animeList *arn.AnimeList
|
||||||
|
var tracks []*arn.SoundTrack
|
||||||
var posts []*arn.Post
|
var posts []*arn.Post
|
||||||
|
|
||||||
flow.Parallel(func() {
|
flow.Parallel(func() {
|
||||||
@ -48,7 +50,14 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
|
|||||||
if len(posts) > maxPosts {
|
if len(posts) > maxPosts {
|
||||||
posts = 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")
|
Icon("rocket")
|
||||||
span= arn.Capitalize(viewUser.Role)
|
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)
|
ProfileHeader(viewUser, user)
|
||||||
|
|
||||||
.profile-category.mountable
|
.profile-category.mountable
|
||||||
@ -58,7 +58,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
|
|||||||
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)
|
||||||
|
|
||||||
.profile-category.mountable
|
.profile-category.mountable
|
||||||
h3
|
h3
|
||||||
a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads
|
a.ajax(href="/+" + viewUser.Nick + "/threads", title="View all threads") Threads
|
||||||
@ -68,6 +68,7 @@ component Profile(viewUser *arn.User, user *arn.User, animeList *arn.AnimeList,
|
|||||||
else
|
else
|
||||||
each thread in threads
|
each thread in threads
|
||||||
ThreadLink(thread)
|
ThreadLink(thread)
|
||||||
|
|
||||||
.profile-category.mountable
|
.profile-category.mountable
|
||||||
h3
|
h3
|
||||||
a.ajax(href="/+" + viewUser.Nick + "/posts", title="View all posts") Posts
|
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
|
.spacer
|
||||||
.post-likes= len(post.Likes)
|
.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"
|
//- if user != nil && user.Role == "admin"
|
||||||
//- .footer
|
//- .footer
|
||||||
//- a(href="/api/user/" + viewUser.ID) User API
|
//- a(href="/api/user/" + viewUser.ID) User API
|
Loading…
Reference in New Issue
Block a user