mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 10:26:17 +00:00
[fileupload] show error message when failed to get upload url
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -95,6 +95,7 @@
|
||||
<span class="loading-icon vam"></span>
|
||||
<span class="vam">{% trans "Saving..." %}</span>
|
||||
</p>
|
||||
<p class="error total-error hide"></p>
|
||||
<table class="fileupload-table"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -46,6 +46,7 @@
|
||||
<div class="progress-extended"></div>
|
||||
</div>
|
||||
<p class="saving-tip alc hide"><img src="{{MEDIA_URL}}img/loading-icon.gif" alt="" style="margin-right:5px;" class="vam" />{% trans "Saving..." %}</p>
|
||||
<p class="error hide"></p>
|
||||
</div>
|
||||
<table class="fileupload-table"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
|
||||
</form>
|
||||
@@ -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;
|
||||
|
@@ -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();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Reference in New Issue
Block a user