2015-02-12 23:22:32 -05:00
|
|
|
import Ember from 'ember';
|
2014-06-09 06:02:51 -05:00
|
|
|
var EditorSaveButtonView = Ember.View.extend({
|
2014-05-21 08:53:00 -05:00
|
|
|
templateName: 'editor-save-button',
|
|
|
|
tagName: 'section',
|
2014-08-20 08:36:25 -05:00
|
|
|
classNames: ['splitbtn', 'js-publish-splitbutton'],
|
2014-05-21 08:53:00 -05:00
|
|
|
|
2014-10-24 16:09:50 -05:00
|
|
|
// Tracks whether we're going to change the state of the post on save
|
2014-12-29 21:11:24 -05:00
|
|
|
isDangerous: Ember.computed('controller.model.isPublished', 'controller.willPublish', function () {
|
|
|
|
return this.get('controller.model.isPublished') !== this.get('controller.willPublish');
|
2014-07-29 20:57:19 -05:00
|
|
|
}),
|
2014-05-21 08:53:00 -05:00
|
|
|
|
2015-04-14 05:48:31 -05:00
|
|
|
publishText: Ember.computed('controller.model.isPublished', 'controller.postOrPage', function () {
|
2015-01-08 13:23:48 -05:00
|
|
|
return this.get('controller.model.isPublished') ? 'Update ' + this.get('controller.postOrPage') : 'Publish Now';
|
2014-07-29 20:57:19 -05:00
|
|
|
}),
|
2014-05-21 08:53:00 -05:00
|
|
|
|
2014-12-29 21:11:24 -05:00
|
|
|
draftText: Ember.computed('controller.model.isPublished', function () {
|
|
|
|
return this.get('controller.model.isPublished') ? 'Unpublish' : 'Save Draft';
|
2014-08-20 08:36:25 -05:00
|
|
|
}),
|
|
|
|
|
2015-01-08 13:23:48 -05:00
|
|
|
deleteText: Ember.computed('controller.postOrPage', function () {
|
|
|
|
return 'Delete ' + this.get('controller.postOrPage');
|
|
|
|
}),
|
|
|
|
|
2015-04-14 05:48:31 -05:00
|
|
|
saveText: Ember.computed('controller.willPublish', 'publishText', 'draftText', function () {
|
2014-08-20 08:36:25 -05:00
|
|
|
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
|
2014-10-18 06:16:43 -05:00
|
|
|
})
|
2014-06-09 06:02:51 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
export default EditorSaveButtonView;
|