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:
commit
a89115318b
1 changed files with 6 additions and 5 deletions
|
@ -44,12 +44,13 @@ var PostsRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, Shortcut
|
|||
|
||||
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) {
|
||||
newPosition = 0;
|
||||
}
|
||||
else if (newPosition < 0) {
|
||||
newPosition = length - 1;
|
||||
return;
|
||||
} else if (newPosition < 0) {
|
||||
return;
|
||||
}
|
||||
this.transitionTo('posts.post', posts.objectAt(newPosition));
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue