Skip to content

A platform for community discussion. Free, open, simple.

FIX: display error message when upload fails in wizard

Arpit Jalanbd760e98af86
diff --git a/app/assets/javascripts/wizard/components/wizard-field-image.js.es6 b/app/assets/javascripts/wizard/components/wizard-field-image.js.es6
index 0778b760814..2db677205b9 100644
--- a/app/assets/javascripts/wizard/components/wizard-field-image.js.es6
+++ b/app/assets/javascripts/wizard/components/wizard-field-image.js.es6
@@ -38,5 +38,21 @@ export default Ember.Component.extend({
this.set("field.value", response.result.url);
this.set("uploading", false);
});
+
+ $upload.on("fileuploadfail", (e, response) => {
+ let message = I18n.t("wizard.upload_error")
+ if (response.jqXHR.responseJSON && response.jqXHR.responseJSON.errors) {
+ message = response.jqXHR.responseJSON.errors.join("\n");
+ }
+
+ window.swal({
+ customClass: "wizard-warning",
+ title: "",
+ text: message,
+ type: "warning",
+ confirmButtonColor: "#6699ff"
+ });
+ this.set("uploading", false);
+ });
}
});
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 6aeedf2c4ae..65dddd18142 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -3949,6 +3949,7 @@ en:
step: "%{current} of %{total}"
upload: "Upload"
uploading: "Uploading..."
+ upload_error: "Sorry, there was an error uploading that file. Please try again."
quit: "Maybe Later"
staff_count:
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 96ed9082ca4..7c87e984c2e 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -3860,7 +3860,7 @@ en:
fields:
favicon_url:
label: "Small Icon"
- description: "Icon image used to represent your site in web browsers that looks good at small sizes such as 32px by 32px."
+ description: "Icon image used to represent your site in web browsers that looks good at small sizes such as 32px by 32px. Recommended image extensions are PNG or JPG."
apple_touch_icon_url:
label: "Large Icon"
description: "Icon image used to represent your site on modern devices that looks good at larger sizes. Recommended size is at least 512px by 512px."