1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/views/editor-save-button.js
Paul Adam Davis 94755b392d 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

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