From 4fdc730913d28a7d06547c610b53edf8808cb964 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 1 Mar 2015 12:33:00 +0000 Subject: [PATCH] More serverside notificaiton HTML fixes refs #4964, #4969 --- ghost/admin/controllers/settings/navigation.js | 4 +++- ghost/admin/routes/application.js | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ghost/admin/controllers/settings/navigation.js b/ghost/admin/controllers/settings/navigation.js index 6b634b0495..ef798f83c5 100644 --- a/ghost/admin/controllers/settings/navigation.js +++ b/ghost/admin/controllers/settings/navigation.js @@ -100,11 +100,13 @@ NavigationController = Ember.Controller.extend({ blogUrl = this.get('config').blogUrl, blogUrlRegex = new RegExp('^' + blogUrl + '(.*)', 'i'), navItems = this.get('navigationItems'), + message = 'One of your navigation items has an empty label. ' + + '
Please enter a new label or delete the item before saving.', match; // Don't save if there's a blank label. if (navItems.find(function (item) { return !item.get('isComplete') && !item.get('last');})) { - self.notifications.showErrors(['One of your navigation items has an empty label.
Please enter a new label or delete the item before saving.']); + self.notifications.showErrors([message.htmlSafe()]); return; } diff --git a/ghost/admin/routes/application.js b/ghost/admin/routes/application.js index 986d87ccc4..2b77facdd5 100644 --- a/ghost/admin/routes/application.js +++ b/ghost/admin/routes/application.js @@ -55,6 +55,11 @@ ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, Shortcut sessionAuthenticationFailed: function (error) { if (error.errors) { + // These are server side errors, which can be marked as htmlSafe + error.errors.forEach(function (err) { + err.message = err.message.htmlSafe(); + }); + this.notifications.showErrors(error.errors); } else { // connection errors don't return proper status message, only req.body