diff --git a/ghost/admin/mixins/editor-base-controller.js b/ghost/admin/mixins/editor-base-controller.js
index 37f256f79e..a75438a1f8 100644
--- a/ghost/admin/mixins/editor-base-controller.js
+++ b/ghost/admin/mixins/editor-base-controller.js
@@ -118,9 +118,57 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
'==============================';
},
+ //TODO: This has to be moved to the I18n localization file.
+ //This structure is supposed to be close to the i18n-localization which will be used soon.
+ messageMap: {
+ errors: {
+ post: {
+ published: {
+ 'published': 'Your post could not be updated.',
+ 'draft': 'Your post could not be saved as a draft.'
+ },
+ draft: {
+ 'published': 'Your post could not be published.',
+ 'draft': 'Your post could not be saved as a draft.'
+ }
+
+ }
+ },
+
+ success: {
+ post: {
+ published: {
+ 'published': 'Your post has been updated.',
+ 'draft': 'Your post has been saved as a draft.'
+ },
+ draft: {
+ 'published': 'Your post has been published.',
+ 'draft': 'Your post has been saved as a draft.'
+ }
+ }
+ }
+ },
+
+ showSaveNotification: function (prevStatus, status, delay) {
+ var message = this.messageMap.success.post[prevStatus][status];
+ this.notifications.closeAll();
+
+ this.notifications.showSuccess(message, delay);
+ },
+
+ showErrorNotification: function (prevStatus, status, errors, delay) {
+ var message = this.messageMap.errors.post[prevStatus][status];
+ this.notifications.closeAll();
+
+ message += '
' + errors[0].message;
+
+ this.notifications.showError(message, delay);
+ },
+
actions: {
save: function () {
var status = this.get('willPublish') ? 'published' : 'draft',
+ prevStatus = this.get('status'),
isNew = this.get('isNew'),
self = this;
@@ -140,11 +188,11 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
// for a saved model it would otherwise be false.
self.set('isDirty', false);
- self.notifications.showSuccess('Post status saved as ' +
- model.get('status') + '.', isNew ? true : false);
+ self.showSaveNotification(prevStatus, model.get('status'), isNew ? true : false);
+
return model;
}).catch(function (errors) {
- self.notifications.showErrors(errors);
+ self.showErrorNotification(prevStatus, self.get('status'), errors);
return Ember.RSVP.reject(errors);
});
},
diff --git a/ghost/admin/mixins/validation-engine.js b/ghost/admin/mixins/validation-engine.js
index a39e8cf6d0..e1fbad7c78 100644
--- a/ghost/admin/mixins/validation-engine.js
+++ b/ghost/admin/mixins/validation-engine.js
@@ -53,7 +53,7 @@ var ValidationEngine = Ember.Mixin.create({
if (Ember.isArray(errors)) {
// get validation error messages
- message += ': ' + errors.mapBy('message').join(' ');
+ message = errors.mapBy('message').join('
');
} else if (typeof errors === 'object') {
// Get messages from server response
message += ': ' + getRequestErrorMessage(errors);