mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 16:41:24 +03:00
Merge pull request #4060 from halfdan/4058-no-posts
Properly handle no posts
This commit is contained in:
commit
4669b9c7fe
@ -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);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -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}}
|
Loading…
Reference in New Issue
Block a user