1
0
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:
llj
2018-03-02 16:11:27 +08:00
parent 5b02073588
commit 6d4000fc20
4 changed files with 33 additions and 7 deletions

View File

@@ -2467,6 +2467,9 @@ button.sf-dropdown-toggle:focus {
.fileupload-buttonbar .cancel { .fileupload-buttonbar .cancel {
*margin-left:5px; *margin-left:5px;
} }
.fixed-upload-file-dialog .total-error {
margin:10px;
}
.fileupload-progress { .fileupload-progress {
margin-top:5px; margin-top:5px;
} }

View File

@@ -95,6 +95,7 @@
<span class="loading-icon vam"></span> <span class="loading-icon vam"></span>
<span class="vam">{% trans "Saving..." %}</span> <span class="vam">{% trans "Saving..." %}</span>
</p> </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> <table class="fileupload-table"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
</div> </div>
</div> </div>

View File

@@ -46,6 +46,7 @@
<div class="progress-extended"></div> <div class="progress-extended"></div>
</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="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> </div>
<table class="fileupload-table"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table> <table class="fileupload-table"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
</form> </form>
@@ -186,8 +187,15 @@ form.fileupload({
} }
}, },
error: function() { error: function(xhr) {
file.error = "{% trans "Failed to get upload url" %}"; 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; return false;

View File

@@ -217,8 +217,15 @@ define([
} }
} }
}, },
error: function() { error: function(xhr) {
file.error = gettext("Failed to get upload url"); 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.url = returned_url;
data.jqXHR = popup.fileupload('send', data); data.jqXHR = popup.fileupload('send', data);
}, },
error: function() { error: function(xhr) {
file.error = gettext("Failed to get update url"); 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();
} }
}); });
}; };