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-20 17:36:25 +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-08-20 17:36:25 +04:00
|
|
|
'publishText': 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-08-20 17:36:25 +04:00
|
|
|
'draftText': Ember.computed('controller.isPublished', function () {
|
2014-05-21 17:53:00 +04:00
|
|
|
return this.get('controller.isPublished') ? 'Unpublish' : 'Save Draft';
|
2014-08-20 17:36:25 +04:00
|
|
|
}),
|
|
|
|
|
|
|
|
'saveText': Ember.computed('controller.willPublish', function () {
|
|
|
|
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
|
|
|
|
}),
|
2014-06-09 15:02:51 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default EditorSaveButtonView;
|