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}} +
{{message}} |