1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/views/editor-save-button.js
Hannah Wolfe 0ac2012673 More autosave improvements
issue #4305, issue #4259, issue #1413

- change new->edit transitionToRoute to be replaceRoute
- auto focus in the editor on transition to the edit route
- change the one-time autosave to happen on codemirror focusin instead of title focusout
- re-add removed tests, and reorder broken test
2014-10-18 17:27:05 +02:00

24 lines
986 B
JavaScript

var EditorSaveButtonView = Ember.View.extend({
templateName: 'editor-save-button',
tagName: 'section',
classNames: ['splitbtn', 'js-publish-splitbutton'],
//Tracks whether we're going to change the state of the post on save
isDangerous: Ember.computed('controller.isPublished', 'controller.willPublish', function () {
return this.get('controller.isPublished') !== this.get('controller.willPublish');
}),
'publishText': Ember.computed('controller.isPublished', function () {
return this.get('controller.isPublished') ? 'Update Post' : 'Publish Now';
}),
'draftText': Ember.computed('controller.isPublished', function () {
return this.get('controller.isPublished') ? 'Unpublish' : 'Save Draft';
}),
'saveText': Ember.computed('controller.willPublish', function () {
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
})
});
export default EditorSaveButtonView;