From 12f117cfbecc5ce5b5ca3433e94e5bdb5cf1c9be Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Thu, 18 Sep 2014 10:20:15 +0000 Subject: [PATCH] Properly handle no posts fixes #4058 - Set noPosts in setupController --- core/client/routes/posts/index.js | 8 +++++++- core/client/templates/posts/index.hbs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/client/routes/posts/index.js b/core/client/routes/posts/index.js index b6a638a0f1..854013b524 100644 --- a/core/client/routes/posts/index.js +++ b/core/client/routes/posts/index.js @@ -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); }); }, diff --git a/core/client/templates/posts/index.hbs b/core/client/templates/posts/index.hbs index 2399915b80..c0c7076e21 100644 --- a/core/client/templates/posts/index.hbs +++ b/core/client/templates/posts/index.hbs @@ -5,4 +5,4 @@ {{#link-to "editor.new"}}{{/link-to}} -{{/if}} +{{/if}} \ No newline at end of file