0001-forms-add-upload-error-handling-to-file-widget-29343.patch
wcs/qommon/static/js/qommon.fileupload.js | ||
---|---|---|
14 | 14 |
pasteZone: base_widget, |
15 | 15 |
dataType: 'json', |
16 | 16 |
add: function (e, data) { |
17 |
$(base_widget).find('.fileprogress').removeClass('upload-error'); |
|
18 |
$(base_widget).find('.fileprogress .bar').text( |
|
19 |
$(base_widget).find('.fileprogress .bar').data('upload')); |
|
17 | 20 |
$(base_widget).find('.fileprogress .bar').css('width', '0%'); |
18 | 21 |
$(base_widget).find('.fileprogress').show(); |
19 | 22 |
$(base_widget).find('.fileinfo').hide(); |
... | ... | |
31 | 34 |
$(base_widget).addClass('has-file').removeClass('has-no-file'); |
32 | 35 |
$(this).trigger('change'); |
33 | 36 |
}, |
37 |
fail: function(e, data) { |
|
38 |
$(base_widget).find('.fileprogress').addClass('upload-error'); |
|
39 |
$(base_widget).find('.fileprogress .bar').text( |
|
40 |
$(base_widget).find('.fileprogress .bar').data('error')); |
|
41 |
}, |
|
34 | 42 |
progress: function (e, data) { |
35 | 43 |
var progress = parseInt(data.loaded / data.total * 100, 10); |
36 | 44 |
$(base_widget).find('.fileprogress .bar').css('width', progress + '%'); |
wcs/qommon/templates/qommon/forms/widgets/file.html | ||
---|---|---|
14 | 14 |
</div> |
15 | 15 |
<style>.click-to-upload, .upload-done { display: none; }</style> |
16 | 16 |
<div class="fileprogress" style="display: none;"> |
17 |
<div class="bar">{% trans "Upload in progress..." %}</div> |
|
17 |
<div class="bar" |
|
18 |
data-upload="{% trans "Upload in progress..." %}" |
|
19 |
data-error="{% trans "Error during upload." %}"></div> |
|
18 | 20 |
</div> |
19 | 21 |
<div class="fileinfo"> |
20 | 22 |
<span class="filename">{{ widget.tempfile.base_filename }}</span> |
21 |
- |