diff --git a/ghost/admin/controllers/debug.js b/ghost/admin/controllers/debug.js index c65511e69a..4fdc18b0db 100644 --- a/ghost/admin/controllers/debug.js +++ b/ghost/admin/controllers/debug.js @@ -1,5 +1,6 @@ var DebugController = Ember.Controller.extend(Ember.Evented, { uploadButtonText: 'Import', + importErrors: '', actions: { onUpload: function (file) { @@ -7,6 +8,7 @@ var DebugController = Ember.Controller.extend(Ember.Evented, { formData = new FormData(); this.set('uploadButtonText', 'Importing'); + this.notifications.closePassive(); formData.append('importfile', file); @@ -20,7 +22,10 @@ var DebugController = Ember.Controller.extend(Ember.Evented, { }).then(function () { self.notifications.showSuccess('Import successful.'); }).catch(function (response) { - self.notifications.showAPIError(response); + if (response && response.jqXHR && response.jqXHR.responseJSON && response.jqXHR.responseJSON.errors) { + self.set('importErrors', response.jqXHR.responseJSON.errors); + } + self.notifications.showError('Import Failed'); }).finally(function () { self.set('uploadButtonText', 'Import'); self.trigger('reset'); diff --git a/ghost/admin/templates/-import-errors.hbs b/ghost/admin/templates/-import-errors.hbs new file mode 100644 index 0000000000..2958b34e7c --- /dev/null +++ b/ghost/admin/templates/-import-errors.hbs @@ -0,0 +1,7 @@ +{{#if importErrors}} + +{{#each importErrors}} + +{{/each}} +
{{message}}
+{{/if}} \ No newline at end of file diff --git a/ghost/admin/templates/debug.hbs b/ghost/admin/templates/debug.hbs index f18500e7f0..ce7da94d9b 100644 --- a/ghost/admin/templates/debug.hbs +++ b/ghost/admin/templates/debug.hbs @@ -28,6 +28,7 @@
+ {{partial "import-errors"}} {{gh-file-upload id="importfile" uploadButtonText=uploadButtonText}}

Import from another Ghost installation. If you import a user, this will replace the current user & log you out.

diff --git a/ghost/admin/utils/notifications.js b/ghost/admin/utils/notifications.js index 5e6aa4c5b8..60ba2c0007 100644 --- a/ghost/admin/utils/notifications.js +++ b/ghost/admin/utils/notifications.js @@ -52,6 +52,8 @@ var Notifications = Ember.ArrayProxy.extend({ if (resp && resp.jqXHR && resp.jqXHR.responseJSON && resp.jqXHR.responseJSON.error) { this.showError(resp.jqXHR.responseJSON.error, delayed); + } else if (resp && resp.jqXHR && resp.jqXHR.responseJSON && resp.jqXHR.responseJSON.errors) { + this.showErrors(resp.jqXHR.responseJSON.errors, delayed); } else { this.showError(defaultErrorText, delayed); }