mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 01:03:23 +03:00
2afc1ff04f
closes #2855 , closes #2848 - New mixin that utilizes NProgress for displaying a loading indictor for all routes who's model issue a "loading" event (aka: when requesting data from the server during a route change). - Also removing (the now unnecessary) "loading" template.
20 lines
589 B
JavaScript
20 lines
589 B
JavaScript
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
|
|
|
var PostsIndexRoute = AuthenticatedRoute.extend(loadingIndicator, {
|
|
// redirect to first post subroute
|
|
beforeModel: function () {
|
|
var self = this;
|
|
|
|
return this.store.find('post', {
|
|
status: 'all',
|
|
staticPages: 'all'
|
|
}).then(function (records) {
|
|
var post = records.get('firstObject');
|
|
return self.transitionTo('posts.post', post);
|
|
});
|
|
}
|
|
});
|
|
|
|
export default PostsIndexRoute;
|