mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
85677984d3
Closes #4557 - The underlying issue is that the PSM is already loaded when Ember routes from an existing post to a new post. Instead of resetting the ‘Published Date’ value manually (with jQuery), I’m using Ember’s computed property setter to ‘refresh’ the cache for that property. I believe that this Ember solution is better than manually going in and resetting it with jQuery.
32 lines
941 B
JavaScript
32 lines
941 B
JavaScript
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
import base from 'ghost/mixins/editor-base-route';
|
|
|
|
var EditorNewRoute = AuthenticatedRoute.extend(base, {
|
|
titleToken: 'Editor',
|
|
|
|
model: function () {
|
|
var self = this;
|
|
return this.get('session.user').then(function (user) {
|
|
return self.store.createRecord('post', {
|
|
author: user
|
|
});
|
|
});
|
|
},
|
|
|
|
setupController: function (controller, model) {
|
|
var psm = this.controllerFor('post-settings-menu');
|
|
|
|
// make sure there are no titleObserver functions hanging around
|
|
// from previous posts
|
|
psm.removeObserver('titleScratch', psm, 'titleObserver');
|
|
|
|
// Ensure that the PSM Image Uploader and Publish Date selector resets
|
|
psm.send('resetUploader');
|
|
psm.send('resetPubDate');
|
|
|
|
this._super(controller, model);
|
|
}
|
|
});
|
|
|
|
export default EditorNewRoute;
|