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