mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Stay on posts.index route when no posts exist
No Issue
This commit is contained in:
parent
df8e7263e1
commit
450095460a
3 changed files with 17 additions and 21 deletions
|
@ -2,7 +2,7 @@ import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|||
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
||||
|
||||
var PostsIndexRoute = AuthenticatedRoute.extend(loadingIndicator, {
|
||||
// redirect to first post subroute
|
||||
// redirect to first post subroute unless no posts exist
|
||||
beforeModel: function () {
|
||||
var self = this;
|
||||
|
||||
|
@ -11,7 +11,10 @@ var PostsIndexRoute = AuthenticatedRoute.extend(loadingIndicator, {
|
|||
staticPages: 'all'
|
||||
}).then(function (records) {
|
||||
var post = records.get('firstObject');
|
||||
return self.transitionTo('posts.post', post);
|
||||
|
||||
if (post) {
|
||||
return self.transitionTo('posts.post', post);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
6
core/client/templates/posts/index.hbs
Normal file
6
core/client/templates/posts/index.hbs
Normal file
|
@ -0,0 +1,6 @@
|
|||
<div class="no-posts-box">
|
||||
<div class="no-posts">
|
||||
<h3>You Haven't Written Any Posts Yet!</h3>
|
||||
{{#link-to "editor.new"}}<button class="button-add large" title="New Post">Write a new Post</button>{{/link-to}}
|
||||
</div>
|
||||
</div>
|
|
@ -1,21 +1,8 @@
|
|||
{{#if title}}
|
||||
{{partial "floating-header"}}
|
||||
|
||||
{{partial "floating-header"}}
|
||||
|
||||
{{#view "content-preview-content-view" tagName="section"}}
|
||||
<div class="wrapper">
|
||||
<h1>{{{title}}}</h1>
|
||||
{{{html}}}
|
||||
</div>
|
||||
{{/view}}
|
||||
|
||||
{{else}}
|
||||
|
||||
<div class="no-posts-box">
|
||||
<div class="no-posts">
|
||||
<h3>You Haven't Written Any Posts Yet!</h3>
|
||||
{{#link-to "editor.new"}}<button class="button-add large" title="New Post">Write a new Post</button>{{/link-to}}
|
||||
</div>
|
||||
{{#view "content-preview-content-view" tagName="section"}}
|
||||
<div class="wrapper">
|
||||
<h1>{{{title}}}</h1>
|
||||
{{{html}}}
|
||||
</div>
|
||||
|
||||
{{/if}}
|
||||
{{/view}}
|
||||
|
|
Loading…
Add table
Reference in a new issue