Ghost/ghost/admin/routes/posts/index.js
David Arvelo 7658cd2ee8 Get single post from API by id and query params; Auto-sort posts list
closes #2883, closes #2951
- introduce custom findQuery in ApplicationAdapter
- posts/post route and editor/edit route now use custom findQuery to find a single post by id with query params
- create a sorting function in PostsController for out-of-order loading
- refresh updated posts in posts.index to make PostsList highlight latest draft after returning from a save in editor
2014-06-17 18:10:11 -04:00

19 lines
508 B
JavaScript

import AuthenticatedRoute from 'ghost/routes/authenticated';
var PostsIndexRoute = AuthenticatedRoute.extend({
// redirect to first post subroute
beforeModel: function () {
var self = this;
return this.store.find('post', {
status: 'all',
staticPages: 'all'
}).then(function (records) {
var post = records.get('firstObject');
return self.transitionTo('posts.post', post);
});
}
});
export default PostsIndexRoute;