import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';

var EditorRoute = AuthenticatedRoute.extend(styleBody, {
    classNames: ['editor'],

    model: function (params) {
        var post = this.store.getById('post', params.post_id);

        if (post) {
            return post;
        }

        return this.store.filter('post', { status: 'all', staticPages: 'all' }, function (post) {
            return post.get('id') === params.post_id;
        }).then(function (records) {
            return records.get('firstObject');
        });
    }
});

export default EditorRoute;

@@ -233,16 +233,259 @@
     var 
+self = this,%0A            post,%0A            postId;%0A%0A        postId = Number(params.post_id);%0A%0A        if (!Number.isInteger(postId) %7C%7C !Number.isFinite(postId) %7C%7C postId %3C= 0) %7B%0A            this.transitionTo('posts.index');%0A        %7D%0A%0A        
 post = t
@@ -510,29 +510,21 @@
 'post', 
-params.
 post
-_i
+I
 d);%0A%0A   
@@ -712,29 +712,21 @@
 d') === 
-params.
 post
-_i
+I
 d;%0A     
@@ -769,22 +769,26 @@
         
-return
+var post =
  records
@@ -807,16 +807,138 @@
 bject');
+%0A%0A            if (post) %7B%0A                return post;%0A            %7D%0A%0A            return self.transitionTo('posts.index');
 %0A       

Handle invalid post ids in editor route