2014-10-28 17:29:42 +03:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
2014-11-04 06:31:10 +03:00
|
|
|
import base from 'ghost/mixins/editor-base-route';
|
2014-03-10 07:44:08 +04:00
|
|
|
|
2014-10-28 17:29:42 +03:00
|
|
|
var EditorNewRoute = AuthenticatedRoute.extend(base, {
|
2014-11-25 23:56:08 +03:00
|
|
|
titleToken: 'Editor',
|
|
|
|
|
2014-05-21 17:53:00 +04:00
|
|
|
model: function () {
|
2014-07-17 09:54:32 +04:00
|
|
|
var self = this;
|
|
|
|
return this.get('session.user').then(function (user) {
|
|
|
|
return self.store.createRecord('post', {
|
|
|
|
author: user
|
|
|
|
});
|
|
|
|
});
|
2014-06-06 05:18:03 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
setupController: function (controller, model) {
|
2014-10-26 02:29:58 +03:00
|
|
|
var psm = this.controllerFor('post-settings-menu');
|
|
|
|
|
|
|
|
// make sure there are no titleObserver functions hanging around
|
|
|
|
// from previous posts
|
|
|
|
psm.removeObserver('titleScratch', psm, 'titleObserver');
|
|
|
|
|
2014-12-01 22:42:35 +03:00
|
|
|
// Ensure that the PSM Image Uploader and Publish Date selector resets
|
2014-11-22 04:42:03 +03:00
|
|
|
psm.send('resetUploader');
|
2014-12-01 22:42:35 +03:00
|
|
|
psm.send('resetPubDate');
|
2014-11-22 04:42:03 +03:00
|
|
|
|
2014-11-04 06:31:10 +03:00
|
|
|
this._super(controller, model);
|
2014-03-10 07:44:08 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-06-10 08:44:29 +04:00
|
|
|
export default EditorNewRoute;
|