mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Merge pull request #2930 from novaugust/save-new-post-transition
Add transition to editor/:id upon saving new post
This commit is contained in:
commit
75c4929a85
@ -1,5 +1,20 @@
|
|||||||
import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
|
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;
|
self = this;
|
||||||
|
|
||||||
this.set('status', status);
|
this.set('status', status);
|
||||||
this.get('model').save().then(function () {
|
return this.get('model').save().then(function (model) {
|
||||||
console.log('saved');
|
|
||||||
self.notifications.showSuccess('Post status saved as <strong>' +
|
self.notifications.showSuccess('Post status saved as <strong>' +
|
||||||
self.get('status') + '</strong>.');
|
model.get('status') + '</strong>.');
|
||||||
|
return model;
|
||||||
}, this.notifications.showErrors);
|
}, this.notifications.showErrors);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user