2014-06-13 23:35:22 +04:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
2014-06-05 07:18:23 +04:00
|
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
2014-06-13 23:35:22 +04:00
|
|
|
|
2014-06-05 07:18:23 +04:00
|
|
|
var PostsIndexRoute = AuthenticatedRoute.extend(loadingIndicator, {
|
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;
|