mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Transition to editor.edit after saving a new post
Closes #2860 - `editor-base-controller`'s `save` action returns a promise with the model after saving - `EditorNewController` will transition to `EditorEditController` upon a successful save (model has an id) - Removed a console.log in editor's save function
This commit is contained in:
parent
26d62fe775
commit
ca422dc1a4
@ -1,5 +1,20 @@
|
||||
import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
|
||||
|
||||
var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin);
|
||||
var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, {
|
||||
actions: {
|
||||
/**
|
||||
* Redirect to editor after the first save
|
||||
*/
|
||||
save: function () {
|
||||
var self = this;
|
||||
this._super().then(function (model) {
|
||||
if (model.get('id')) {
|
||||
self.transitionTo('editor.edit', model);
|
||||
}
|
||||
return model;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default EditorNewController;
|
||||
export default EditorNewController;
|
@ -22,10 +22,10 @@ var EditorControllerMixin = Ember.Mixin.create({
|
||||
self = this;
|
||||
|
||||
this.set('status', status);
|
||||
this.get('model').save().then(function () {
|
||||
console.log('saved');
|
||||
return this.get('model').save().then(function (model) {
|
||||
self.notifications.showSuccess('Post status saved as <strong>' +
|
||||
self.get('status') + '</strong>.');
|
||||
model.get('status') + '</strong>.');
|
||||
return model;
|
||||
}, this.notifications.showErrors);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user