mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Merge pull request #5131 from ErisDS/issue-5130
Don't do autosave on new post
This commit is contained in:
commit
ac403efd29
2 changed files with 3 additions and 18 deletions
|
@ -2,6 +2,8 @@ import Ember from 'ember';
|
|||
import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
|
||||
|
||||
var EditorNewController = Ember.Controller.extend(EditorControllerMixin, {
|
||||
// Overriding autoSave on the base controller, as the new controller shouldn't be autosaving
|
||||
autoSave: Ember.K,
|
||||
actions: {
|
||||
/**
|
||||
* Redirect to editor after the first save
|
||||
|
|
|
@ -31,26 +31,9 @@ EditorControllerMixin = Ember.Mixin.create({
|
|||
return self.get('isDirty') ? self.unloadDirtyMessage() : null;
|
||||
};
|
||||
},
|
||||
lastModelId: null,
|
||||
modelChanged: Ember.computed('model.id', function (key, value) {
|
||||
var modelId = this.get('model.id');
|
||||
|
||||
if (arguments.length > 1) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (this.get('lastModelId') === modelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.set('lastModelId', modelId);
|
||||
return true;
|
||||
}),
|
||||
autoSave: function () {
|
||||
// Don't save just because we swapped out models
|
||||
if (this.get('modelChanged')) {
|
||||
this.set('modelChanged', false);
|
||||
} else if (this.get('model.isDraft') && !this.get('model.isNew')) {
|
||||
if (this.get('model.isDraft') && !this.get('model.isNew')) {
|
||||
var autoSaveId,
|
||||
timedSaveId;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue