Fixed scrolling on soundtracks

This commit is contained in:
Eduard Urbach 2018-02-26 12:48:25 +01:00
parent be11447d4e
commit 771a222787
3 changed files with 10 additions and 14 deletions

View File

@ -22,11 +22,15 @@ func Latest(ctx *aero.Context) string {
arn.SortSoundTracksLatestFirst(tracks) arn.SortSoundTracksLatestFirst(tracks)
// Limit the number of displayed tracks
loadMoreIndex := 0
if len(tracks) > maxTracks { if len(tracks) > maxTracks {
tracks = 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. // LatestFrom renders the soundtracks from the given index.

View File

@ -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 h1.page-title Soundtracks
SoundTracksTabs SoundTracksTabs
@ -17,9 +17,9 @@ component SoundTracks(tracks []*arn.SoundTrack, tracksPerPage int, user *arn.Use
#load-more-target.sound-tracks #load-more-target.sound-tracks
SoundTracksScrollable(tracks, user) SoundTracksScrollable(tracks, user)
if len(tracks) == tracksPerPage if loadMoreIndex != 0
.buttons .buttons
LoadMore(tracksPerPage) LoadMore(loadMoreIndex)
component SoundTracksScrollable(tracks []*arn.SoundTrack, user *arn.User) component SoundTracksScrollable(tracks []*arn.SoundTrack, user *arn.User)
each track in tracks each track in tracks

View File

@ -88,19 +88,11 @@ var routeTests = map[string][]string{
}, },
"/quote/:id": []string{ "/quote/:id": []string{
"/quote/-8I3JKykR", "/quote/gUZugd6zR",
}, },
"/quote/:id/edit": []string{ "/quote/:id/edit": []string{
"/quote/-8I3JKykR/edit", "/quote/gUZugd6zR/edit",
},
"/quotes": []string{
"/quotes",
},
"/quotes/best": []string{
"/quotes/best",
}, },
"/quotes/from/:index": []string{ "/quotes/from/:index": []string{