2014-06-09 15:02:51 +04:00
|
|
|
var EditorSaveButtonView = Ember.View.extend({
|
2014-05-21 17:53:00 +04:00
|
|
|
templateName: 'editor-save-button',
|
|
|
|
tagName: 'section',
|
2014-08-06 03:07:32 +04:00
|
|
|
classNames: ['splitbtn js-publish-splitbutton'],
|
2014-05-21 17:53:00 +04:00
|
|
|
|
|
|
|
//Tracks whether we're going to change the state of the post on save
|
2014-07-30 05:57:19 +04:00
|
|
|
isDangerous: Ember.computed('controller.isPublished', 'controller.willPublish', function () {
|
2014-05-21 17:53:00 +04:00
|
|
|
return this.get('controller.isPublished') !== this.get('controller.willPublish');
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
2014-05-21 17:53:00 +04:00
|
|
|
|
2014-07-30 05:57:19 +04:00
|
|
|
'save-text': Ember.computed('controller.willPublish', function () {
|
2014-05-21 17:53:00 +04:00
|
|
|
return this.get('controller.willPublish') ? this.get('publish-text') : this.get('draft-text');
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
2014-05-21 17:53:00 +04:00
|
|
|
|
2014-07-30 05:57:19 +04:00
|
|
|
'publish-text': Ember.computed('controller.isPublished', function () {
|
2014-05-21 17:53:00 +04:00
|
|
|
return this.get('controller.isPublished') ? 'Update Post' : 'Publish Now';
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
2014-05-21 17:53:00 +04:00
|
|
|
|
2014-07-30 05:57:19 +04:00
|
|
|
'draft-text': Ember.computed('controller.isPublished', function () {
|
2014-05-21 17:53:00 +04:00
|
|
|
return this.get('controller.isPublished') ? 'Unpublish' : 'Save Draft';
|
2014-07-30 05:57:19 +04:00
|
|
|
})
|
2014-06-09 15:02:51 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default EditorSaveButtonView;
|