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

Merge pull request #3655 from rwjblue/dont-loop-keyboard-nav

Do not loop keyboard nav on content list.
This commit is contained in:
Hannah Wolfe 2014-08-07 19:30:48 +01:00
commit a89115318b

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));
}, },