2014-03-03 21:18:10 +01:00
|
|
|
import styleBody from 'ghost/mixins/style-body';
|
2014-03-11 17:23:32 +01:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
2014-05-09 00:00:10 -05:00
|
|
|
|
2014-03-11 17:23:32 +01:00
|
|
|
var EditorRoute = AuthenticatedRoute.extend(styleBody, {
|
2014-03-03 21:18:10 +01:00
|
|
|
classNames: ['editor'],
|
2014-04-20 08:48:34 -06:00
|
|
|
controllerName: 'posts.post',
|
2014-03-02 15:30:35 +01:00
|
|
|
model: function (params) {
|
2014-06-05 13:23:28 -04:00
|
|
|
var post = this.store.getById('post', params.post_id);
|
|
|
|
|
|
|
|
if (post) {
|
|
|
|
return post;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.store.filter('post', { status: 'all' }, function (post) {
|
|
|
|
return post.get('id') === params.post_id;
|
|
|
|
}).then(function (records) {
|
|
|
|
return records.get('firstObject');
|
|
|
|
});
|
2014-03-02 15:30:35 +01:00
|
|
|
}
|
2014-03-03 21:18:10 +01:00
|
|
|
});
|
|
|
|
|
2014-04-20 08:48:34 -06:00
|
|
|
export default EditorRoute;
|