mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Ember.ObjectController (and Ember.ArrayController) will be deprecated in Ember 1.11 (and removed from core in Ember 2.0). The reasoning is detailed in the Ember 2.0 RFC. This PR does the following: * Updates templates/controllers/views to explicitly reference model properties (instead of relying on proxying behavior). * Clearly delineate where certain properties are being set or retrieved from (for example it was not clear exactly where `scratch` and `titleScratch` were stored). * Remove usage of `Ember.ObjectController`. * Add JSCS rule to prevent future PR's from adding regressions.
24 lines
1,017 B
JavaScript
24 lines
1,017 B
JavaScript
var EditorSaveButtonView = Ember.View.extend({
|
|
templateName: 'editor-save-button',
|
|
tagName: 'section',
|
|
classNames: ['splitbtn', 'js-publish-splitbutton'],
|
|
|
|
// Tracks whether we're going to change the state of the post on save
|
|
isDangerous: Ember.computed('controller.model.isPublished', 'controller.willPublish', function () {
|
|
return this.get('controller.model.isPublished') !== this.get('controller.willPublish');
|
|
}),
|
|
|
|
publishText: Ember.computed('controller.model.isPublished', function () {
|
|
return this.get('controller.model.isPublished') ? 'Update Post' : 'Publish Now';
|
|
}),
|
|
|
|
draftText: Ember.computed('controller.model.isPublished', function () {
|
|
return this.get('controller.model.isPublished') ? 'Unpublish' : 'Save Draft';
|
|
}),
|
|
|
|
saveText: Ember.computed('controller.willPublish', function () {
|
|
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
|
|
})
|
|
});
|
|
|
|
export default EditorSaveButtonView;
|