Merge pull request #4060 from halfdan/4058-no-posts

Properly handle no posts
This commit is contained in:
Matt Enlow 2014-09-18 18:43:19 -06:00
commit 4669b9c7fe
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);
});
},

View File

@ -5,4 +5,4 @@
{{#link-to "editor.new"}}<button type="button" class="btn btn-green btn-lg" title="New Post">Write a new Post</button>{{/link-to}}
</div>
</div>
{{/if}}
{{/if}}