mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
4c72c318d5
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.
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
import styleBody from 'ghost/mixins/style-body';
|
|
import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
|
|
|
var paginationSettings = {
|
|
status: 'all',
|
|
staticPages: 'all',
|
|
page: 1
|
|
};
|
|
|
|
var PostsRoute = AuthenticatedRoute.extend(ShortcutsRoute, styleBody, loadingIndicator, {
|
|
classNames: ['manage'],
|
|
|
|
model: function () {
|
|
// using `.filter` allows the template to auto-update when new models are pulled in from the server.
|
|
// we just need to 'return true' to allow all models by default.
|
|
return this.store.filter('post', paginationSettings, function () {
|
|
return true;
|
|
});
|
|
},
|
|
|
|
setupController: function (controller, model) {
|
|
this._super(controller, model);
|
|
controller.set('paginationSettings', paginationSettings);
|
|
},
|
|
|
|
shortcuts: {
|
|
'up': 'moveUp',
|
|
'down': 'moveDown'
|
|
},
|
|
actions: {
|
|
openEditor: function (post) {
|
|
this.transitionTo('editor', post);
|
|
},
|
|
moveUp: function () {
|
|
window.alert('@todo keyboard post navigation: up');
|
|
},
|
|
moveDown: function () {
|
|
window.alert('@todo keyboard post navigation: down');
|
|
}
|
|
}
|
|
});
|
|
|
|
export default PostsRoute;
|