0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/views/editor-save-button.js
2014-08-17 14:53:47 +03:00

24 lines
960 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: function () {
return this.get('controller.isPublished') !== this.get('controller.willPublish');
}.property('controller.isPublished', 'controller.willPublish'),
'save-text': function () {
return this.get('controller.willPublish') ? this.get('publish-text') : this.get('draft-text');
}.property('controller.willPublish'),
'publish-text': function () {
return this.get('controller.isPublished') ? 'Update Post' : 'Publish Now';
}.property('controller.isPublished'),
'draft-text': function () {
return this.get('controller.isPublished') ? 'Unpublish' : 'Save Draft';
}.property('controller.isPublished')
});
export default EditorSaveButtonView;