2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
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
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
// Tracks whether we're going to change the state of the post on save
|
2014-12-30 05:11:24 +03:00
|
|
|
isDangerous: Ember.computed('controller.model.isPublished', 'controller.willPublish', function () {
|
|
|
|
return this.get('controller.model.isPublished') !== this.get('controller.willPublish');
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
2014-05-21 17:53:00 +04:00
|
|
|
|
2015-04-14 13:48:31 +03:00
|
|
|
publishText: Ember.computed('controller.model.isPublished', 'controller.postOrPage', function () {
|
2015-01-08 21:23:48 +03:00
|
|
|
return this.get('controller.model.isPublished') ? 'Update ' + this.get('controller.postOrPage') : 'Publish Now';
|
2014-07-30 05:57:19 +04:00
|
|
|
}),
|
2014-05-21 17:53:00 +04:00
|
|
|
|
2014-12-30 05:11:24 +03:00
|
|
|
draftText: Ember.computed('controller.model.isPublished', function () {
|
|
|
|
return this.get('controller.model.isPublished') ? 'Unpublish' : 'Save Draft';
|
2014-08-20 17:36:25 +04:00
|
|
|
}),
|
|
|
|
|
2015-01-08 21:23:48 +03:00
|
|
|
deleteText: Ember.computed('controller.postOrPage', function () {
|
|
|
|
return 'Delete ' + this.get('controller.postOrPage');
|
|
|
|
}),
|
|
|
|
|
2015-04-14 13:48:31 +03:00
|
|
|
saveText: Ember.computed('controller.willPublish', 'publishText', 'draftText', function () {
|
2014-08-20 17:36:25 +04:00
|
|
|
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
|
2014-10-18 15:16:43 +04:00
|
|
|
})
|
2014-06-09 15:02:51 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default EditorSaveButtonView;
|