Fixed scrolling on soundtracks
This commit is contained in:
parent
be11447d4e
commit
771a222787
@ -22,11 +22,15 @@ func Latest(ctx *aero.Context) string {
|
||||
|
||||
arn.SortSoundTracksLatestFirst(tracks)
|
||||
|
||||
// Limit the number of displayed tracks
|
||||
loadMoreIndex := 0
|
||||
|
||||
if len(tracks) > maxTracks {
|
||||
tracks = tracks[:maxTracks]
|
||||
loadMoreIndex = maxTracks
|
||||
}
|
||||
|
||||
return ctx.HTML(components.SoundTracks(tracks, maxTracks, user))
|
||||
return ctx.HTML(components.SoundTracks(tracks, loadMoreIndex, user))
|
||||
}
|
||||
|
||||
// LatestFrom renders the soundtracks from the given index.
|
||||
|
@ -1,4 +1,4 @@
|
||||
component SoundTracks(tracks []*arn.SoundTrack, tracksPerPage int, user *arn.User)
|
||||
component SoundTracks(tracks []*arn.SoundTrack, loadMoreIndex int, user *arn.User)
|
||||
h1.page-title Soundtracks
|
||||
|
||||
SoundTracksTabs
|
||||
@ -17,9 +17,9 @@ component SoundTracks(tracks []*arn.SoundTrack, tracksPerPage int, user *arn.Use
|
||||
#load-more-target.sound-tracks
|
||||
SoundTracksScrollable(tracks, user)
|
||||
|
||||
if len(tracks) == tracksPerPage
|
||||
if loadMoreIndex != 0
|
||||
.buttons
|
||||
LoadMore(tracksPerPage)
|
||||
LoadMore(loadMoreIndex)
|
||||
|
||||
component SoundTracksScrollable(tracks []*arn.SoundTrack, user *arn.User)
|
||||
each track in tracks
|
||||
|
12
tests.go
12
tests.go
@ -88,19 +88,11 @@ var routeTests = map[string][]string{
|
||||
},
|
||||
|
||||
"/quote/:id": []string{
|
||||
"/quote/-8I3JKykR",
|
||||
"/quote/gUZugd6zR",
|
||||
},
|
||||
|
||||
"/quote/:id/edit": []string{
|
||||
"/quote/-8I3JKykR/edit",
|
||||
},
|
||||
|
||||
"/quotes": []string{
|
||||
"/quotes",
|
||||
},
|
||||
|
||||
"/quotes/best": []string{
|
||||
"/quotes/best",
|
||||
"/quote/gUZugd6zR/edit",
|
||||
},
|
||||
|
||||
"/quotes/from/:index": []string{
|
||||
|
Loading…
Reference in New Issue
Block a user