diff --git a/media/css/seahub.css b/media/css/seahub.css index 5b2d2185d0..8fbef56bb0 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -2467,6 +2467,9 @@ button.sf-dropdown-toggle:focus { .fileupload-buttonbar .cancel { *margin-left:5px; } +.fixed-upload-file-dialog .total-error { + margin:10px; +} .fileupload-progress { margin-top:5px; } diff --git a/seahub/templates/js/lib-op-popups.html b/seahub/templates/js/lib-op-popups.html index c47675683f..b611283d6a 100644 --- a/seahub/templates/js/lib-op-popups.html +++ b/seahub/templates/js/lib-op-popups.html @@ -95,6 +95,7 @@ {% trans "Saving..." %}

+

diff --git a/seahub/templates/view_shared_upload_link.html b/seahub/templates/view_shared_upload_link.html index d6a8c9c272..242ca93fac 100644 --- a/seahub/templates/view_shared_upload_link.html +++ b/seahub/templates/view_shared_upload_link.html @@ -46,6 +46,7 @@

{% trans "Saving..." %}

+

@@ -186,8 +187,15 @@ form.fileupload({ } }, - error: function() { - file.error = "{% trans "Failed to get upload url" %}"; + error: function(xhr) { + var error_msg; + if (xhr.responseJSON) { + error_msg = xhr.responseJSON.error; + } else { + error_msg = "{% trans "Error" %}"; + } + data.abort(); + $('.fileupload-buttonbar .error').html(error_msg).show(); } }); return false; diff --git a/static/scripts/app/views/fileupload.js b/static/scripts/app/views/fileupload.js index c3046c0f22..b6f3407159 100644 --- a/static/scripts/app/views/fileupload.js +++ b/static/scripts/app/views/fileupload.js @@ -28,7 +28,7 @@ define([ fileupdateConfirmTemplate: _.template($("#fileupdate-confirm-template").html()), - initialize: function (options) { + initialize: function(options) { var dirView = this.dirView = options.dirView; var dirents = dirView.dir; @@ -217,8 +217,15 @@ define([ } } }, - error: function() { - file.error = gettext("Failed to get upload url"); + error: function(xhr) { + var error_msg; + if (xhr.responseJSON) { + error_msg = xhr.responseJSON.error_msg; + } else { + error_msg = gettext("Error"); + } + data.abort(); + _this.$('.total-error').html(error_msg).show(); } }); }; @@ -250,8 +257,15 @@ define([ data.url = returned_url; data.jqXHR = popup.fileupload('send', data); }, - error: function() { - file.error = gettext("Failed to get update url"); + error: function(xhr) { + var error_msg; + if (xhr.responseJSON) { + error_msg = xhr.responseJSON.error_msg; + } else { + error_msg = gettext("Error"); + } + data.abort(); + _this.$('.total-error').html(error_msg).show(); } }); };