mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Don't do autosave on new post
closes #5130 - rather than checking for a model change, noop autosave on new controller
This commit is contained in:
parent
7a5a9eed69
commit
8f354ddbc2
@ -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…
Reference in New Issue
Block a user