Ghost/core/client/routes/posts.js
David Arvelo 8cbc6dc3b7 Calls to POST API have include=tags
closes #2998
- update PostSerializer to use DS.EmbeddedRecordsMixin
- create PostAdapter to include include=tags in query params for POST and PUT
- set include=tags for various GET post requests
- change PostModel to have { embedded: always } instead of { async: true }
- update Ember-Data to beta8 from beta7
- make call to get tags from model in editor.edit route synchronous since the tags now exist in the store
- change casper test to wait for call to posts api with `?include=tags`
2014-06-28 03:13:31 -04:00

47 lines
1.4 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',
include: 'tags',
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.edit', post);
},
moveUp: function () {
window.alert('@todo keyboard post navigation: up');
},
moveDown: function () {
window.alert('@todo keyboard post navigation: down');
}
}
});
export default PostsRoute;