0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Properly handle no posts

fixes #4058
- Set noPosts in setupController
This commit is contained in:
Fabian Becker 2014-09-18 10:20:15 +00:00
parent a4ef0c7118
commit 4af5b89c60
2 changed files with 8 additions and 2 deletions

View file

@ -3,6 +3,7 @@ import loadingIndicator from 'ghost/mixins/loading-indicator';
import mobileQuery from 'ghost/utils/mobile';
var PostsIndexRoute = MobileIndexRoute.extend(SimpleAuth.AuthenticatedRouteMixin, loadingIndicator, {
noPosts: false,
// Transition to a specific post if we're not on mobile
beforeModel: function () {
if (!mobileQuery.matches) {
@ -10,6 +11,11 @@ var PostsIndexRoute = MobileIndexRoute.extend(SimpleAuth.AuthenticatedRouteMixin
}
},
setupController: function (controller, model) {
/*jshint unused:false*/
controller.set('noPosts', this.get('noPosts'));
},
goToPost: function () {
var self = this,
// the store has been populated by PostsRoute
@ -26,7 +32,7 @@ var PostsIndexRoute = MobileIndexRoute.extend(SimpleAuth.AuthenticatedRouteMixin
if (post) {
return self.transitionTo('posts.post', post);
}
self.get('controller').set('noPosts', true);
self.set('noPosts', true);
});
},