0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Do not loop keyboard nav on content list.

This commit is contained in:
Robert Jackson 2014-08-07 09:12:51 -04:00
parent 7b21ca64a5
commit 7ff58e442b

View file

@ -44,12 +44,13 @@ var PostsRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, Shortcut
newPosition = posts.indexOf(currentPost) + step; newPosition = posts.indexOf(currentPost) + step;
//Make sure we're inbounds // if we are on the first or last item
// just do nothing (desired behavior is to not
// loop around)
if (newPosition >= length) { if (newPosition >= length) {
newPosition = 0; return;
} } else if (newPosition < 0) {
else if (newPosition < 0) { return;
newPosition = length - 1;
} }
this.transitionTo('posts.post', posts.objectAt(newPosition)); this.transitionTo('posts.post', posts.objectAt(newPosition));
}, },