Ghost/core/client/app/views/editor-save-button.js
Paul Adam Davis 9ea2f5535e Show correct type in publish button
Closes #5138

Shows the correct type (post or page)  in the publish button
2015-04-15 11:13:38 +01:00

30 lines
1.2 KiB
JavaScript

import Ember from 'ember';
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.model.isPublished', 'controller.willPublish', function () {
return this.get('controller.model.isPublished') !== this.get('controller.willPublish');
}),
publishText: Ember.computed('controller.model.isPublished', 'controller.postOrPage', function () {
return this.get('controller.model.isPublished') ? 'Update ' + this.get('controller.postOrPage') : 'Publish Now';
}),
draftText: Ember.computed('controller.model.isPublished', function () {
return this.get('controller.model.isPublished') ? 'Unpublish' : 'Save Draft';
}),
deleteText: Ember.computed('controller.postOrPage', function () {
return 'Delete ' + this.get('controller.postOrPage');
}),
saveText: Ember.computed('controller.willPublish', 'publishText', 'draftText', function () {
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
})
});
export default EditorSaveButtonView;