Add related soundtracks to soundtrack page
This commit is contained in:
parent
3cf7697184
commit
2d44bc8515
@ -19,7 +19,15 @@ func Get(ctx aero.Context) error {
|
||||
return ctx.Error(http.StatusNotFound, "Track not found", err)
|
||||
}
|
||||
|
||||
var relatedTracks []*arn.SoundTrack
|
||||
for _, anime := range track.Anime() {
|
||||
tracks := arn.FilterSoundTracks(func(t *arn.SoundTrack) bool {
|
||||
return !t.IsDraft && len(t.Media) > 0 && t.ID != track.ID && arn.Contains(t.Tags, "anime:"+anime.ID)
|
||||
})
|
||||
relatedTracks = append(relatedTracks, tracks...)
|
||||
}
|
||||
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(track)
|
||||
return ctx.HTML(components.SoundTrackPage(track, user))
|
||||
return ctx.HTML(components.SoundTrackPage(track, relatedTracks, user))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
component SoundTrackPage(track *arn.SoundTrack, user *arn.User)
|
||||
component SoundTrackPage(track *arn.SoundTrack, relatedTracks []*arn.SoundTrack, user *arn.User)
|
||||
SoundTrackTabs(track, user)
|
||||
|
||||
.soundtrack-full-page
|
||||
@ -37,6 +37,13 @@ component SoundTrackPage(track *arn.SoundTrack, user *arn.User)
|
||||
li
|
||||
a.soundtrack-link(href=link.URL, target="_blank")= link.Title
|
||||
|
||||
if len(relatedTracks) > 0
|
||||
.widget.mountable
|
||||
h3.widget-title Related SoundTracks
|
||||
.soundtracks.anime-soundtracks
|
||||
each relatedTrack in relatedTracks
|
||||
SoundTrackMini(relatedTrack, user)
|
||||
|
||||
//- TODO: This is quite ineffective, performance-wise
|
||||
if len(track.OsuBeatmaps()) > 0 || len(track.EtternaBeatmaps()) > 0
|
||||
.widget.mountable
|
||||
|
Loading…
Reference in New Issue
Block a user