mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
9ea2f5535e
Closes #5138 Shows the correct type (post or page) in the publish button
30 lines
1.2 KiB
JavaScript
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;
|