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:
Hannah Wolfe 2015-04-11 16:44:25 +01:00
parent 7a5a9eed69
commit 8f354ddbc2
2 changed files with 3 additions and 18 deletions

View File

@ -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

View File

@ -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;