From 1c9ff6421d7a11ea38ee4658c146a8a5c07328ee Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Tue, 26 Mar 2019 18:23:30 +0100 Subject: [PATCH] Fix uploader --- cps/static/js/uploadprogress.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/cps/static/js/uploadprogress.js b/cps/static/js/uploadprogress.js index f7a26571..8f70d2d0 100644 --- a/cps/static/js/uploadprogress.js +++ b/cps/static/js/uploadprogress.js @@ -130,22 +130,19 @@ this.$modalFooter.show(); var contentType = xhr.getResponseHeader("Content-Type"); - // Replace the contents of the form, with the returned html - if (xhr.status === 422) { - var newHtml = $.parseHTML(xhr.responseText); - this.replaceForm(newHtml); - this.$modal.modal("hide"); - } // Write the error response to the document. - else{ - // Handle no response error - if (contentType) { - var responseText = xhr.responseText; - if (contentType.indexOf("text/plain") !== -1) { - responseText = "
" + responseText + "
"; - } + if (contentType || xhr.status === 422) { + var responseText = xhr.responseText; + if (contentType.indexOf("text/plain") !== -1) { + responseText = "
" + responseText + "
"; document.write(responseText); } + else { + this.$modalBar.text(responseText); + } + } + else { + this.$modalBar.text(this.options.modalTitleFailed); } },