Merge pull request #4774 from felixrieseberg/iss4768

Editor Save Button/Notifcations: Post vs Page
This commit is contained in:
Jason Williams 2015-01-09 11:26:31 -06:00
commit 481af2ddee
3 changed files with 12 additions and 4 deletions

View File

@ -50,6 +50,10 @@ EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
return this.get('model.tags').mapBy('name');
}),
postOrPage: Ember.computed('model.page', function () {
return this.get('model.page') ? 'Page' : 'Post';
}),
// compares previousTagNames to tagNames
tagNamesEqual: function () {
var tagNames = this.get('tagNames'),
@ -191,7 +195,7 @@ EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
path = this.get('ghostPaths.url').join(this.get('config.blogUrl'), this.get('model.url'));
if (status === 'published') {
message += '&nbsp;<a href="' + path + '">View Post</a>';
message += '&nbsp;<a href="' + path + '">View ' + this.get('postOrPage') + '</a>';
}
this.notifications.showSuccess(message, {delayed: delay});
},

View File

@ -13,7 +13,7 @@
</li>
<li class="divider delete"></li>
<li class="delete">
<a {{action "openModal" "delete-post" this}} href="#">Delete Post</a>
<a {{action "openModal" "delete-post" this}} href="#">{{view.deleteText}}</a>
</li>
</ul>
{{/gh-dropdown}}

View File

@ -8,14 +8,18 @@ var EditorSaveButtonView = Ember.View.extend({
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';
publishText: Ember.computed('controller.model.isPublished', 'controller.pageOrPost', function () {
return this.get('controller.model.isPublished') ? 'Update ' + this.get('controller.postOrPage') : 'Publish Now';
}),
draftText: Ember.computed('controller.model.isPublished', function () {
return this.get('controller.model.isPublished') ? 'Unpublish' : 'Save Draft';
}),
deleteText: Ember.computed('controller.postOrPage', function () {
return 'Delete ' + this.get('controller.postOrPage');
}),
saveText: Ember.computed('controller.willPublish', function () {
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
})