2014-06-13 23:35:22 +04:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
|
|
|
|
|
|
var PostsIndexRoute = AuthenticatedRoute.extend({
|
2014-03-02 18:30:35 +04:00
|
|
|
// redirect to first post subroute
|
2014-06-17 23:17:08 +04:00
|
|
|
beforeModel: function () {
|
|
|
|
var self = this;
|
2014-03-02 18:30:35 +04:00
|
|
|
|
2014-06-17 23:17:08 +04:00
|
|
|
return this.store.find('post', {
|
|
|
|
status: 'all',
|
|
|
|
staticPages: 'all'
|
|
|
|
}).then(function (records) {
|
|
|
|
var post = records.get('firstObject');
|
|
|
|
return self.transitionTo('posts.post', post);
|
|
|
|
});
|
2014-03-02 18:30:35 +04:00
|
|
|
}
|
2014-03-04 00:18:10 +04:00
|
|
|
});
|
|
|
|
|
2014-06-13 23:35:22 +04:00
|
|
|
export default PostsIndexRoute;
|