2014-06-04 22:18:23 -05:00
|
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
2014-06-13 14:35:22 -05:00
|
|
|
|
2014-06-30 07:58:10 -05:00
|
|
|
var PostsIndexRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, loadingIndicator, {
|
2014-07-21 09:13:52 -05:00
|
|
|
// This route's only function is to determine whether or not a post
|
|
|
|
// exists to be used for the content preview. It has a parent resource (Posts)
|
|
|
|
// that is responsible for populating the store.
|
2014-06-17 14:17:08 -05:00
|
|
|
beforeModel: function () {
|
2014-07-21 09:13:52 -05:00
|
|
|
// the store has been populated so we can work with the local copy
|
|
|
|
var post = this.store.all('post').get('firstObject');
|
2014-03-02 09:30:35 -05:00
|
|
|
|
2014-07-21 09:13:52 -05:00
|
|
|
if (post) {
|
|
|
|
return this.transitionTo('posts.post', post);
|
|
|
|
}
|
2014-03-02 09:30:35 -05:00
|
|
|
}
|
2014-03-03 15:18:10 -05:00
|
|
|
});
|
|
|
|
|
2014-06-13 14:35:22 -05:00
|
|
|
export default PostsIndexRoute;
|