mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 06:25:51 +03:00
2cf81164f7
Closes #2747 - Added new 'editor-save-button' view and template. - Added save action to post controller. - Set a new post as the default model for the /editor/ route. - Set the `posts/post` controller as the controller for the /editor/ route. - Needs ghost-popover #2418 component for full pop-up functionality
23 lines
976 B
JavaScript
23 lines
976 B
JavaScript
export default Ember.View.extend({
|
|
templateName: 'editor-save-button',
|
|
tagName: 'section',
|
|
classNames: ['js-publish-splitbutton'],
|
|
classNameBindings: ['isDangerous:splitbutton-delete:splitbutton-save'],
|
|
|
|
//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')
|
|
}); |