2014-06-19 23:44:44 +04:00
|
|
|
import styleBody from 'ghost/mixins/style-body';
|
|
|
|
import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
|
2014-06-05 07:18:23 +04:00
|
|
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
2014-07-20 20:42:03 +04:00
|
|
|
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
|
2014-03-02 18:30:35 +04:00
|
|
|
|
2014-05-24 07:25:20 +04:00
|
|
|
var paginationSettings = {
|
|
|
|
status: 'all',
|
|
|
|
staticPages: 'all',
|
2014-06-20 14:40:32 +04:00
|
|
|
page: 1
|
2014-05-24 07:25:20 +04:00
|
|
|
};
|
|
|
|
|
2014-07-20 20:42:03 +04:00
|
|
|
var PostsRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, ShortcutsRoute, styleBody, loadingIndicator, PaginationRouteMixin, {
|
2014-03-04 00:18:10 +04:00
|
|
|
classNames: ['manage'],
|
2014-03-02 18:30:35 +04:00
|
|
|
|
|
|
|
model: function () {
|
2014-05-24 07:25:20 +04:00
|
|
|
// 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);
|
2014-07-20 20:42:03 +04:00
|
|
|
this.setupPagination(paginationSettings);
|
2014-03-02 18:30:35 +04:00
|
|
|
},
|
|
|
|
|
2014-06-19 23:44:44 +04:00
|
|
|
shortcuts: {
|
|
|
|
'up': 'moveUp',
|
|
|
|
'down': 'moveDown'
|
|
|
|
},
|
2014-03-02 18:30:35 +04:00
|
|
|
actions: {
|
|
|
|
openEditor: function (post) {
|
2014-06-21 18:44:53 +04:00
|
|
|
this.transitionTo('editor.edit', post);
|
2014-06-19 23:44:44 +04:00
|
|
|
},
|
|
|
|
moveUp: function () {
|
|
|
|
window.alert('@todo keyboard post navigation: up');
|
|
|
|
},
|
|
|
|
moveDown: function () {
|
|
|
|
window.alert('@todo keyboard post navigation: down');
|
2014-03-02 18:30:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2014-03-04 00:18:10 +04:00
|
|
|
|
2014-04-20 18:48:34 +04:00
|
|
|
export default PostsRoute;
|