forms: add classes to filewidget to indicate its filledness status (#18744)

This commit is contained in:
Frédéric Péters 2017-09-16 15:15:03 +02:00
parent 91a4409209
commit 0d990a433c
1 changed files with 4 additions and 0 deletions

View File

@ -4,8 +4,10 @@ $(function() {
if ($(base_widget).find('input[type=hidden]').val()) {
$(base_widget).find('input[type=file]').hide();
$(base_widget).find('.use-file-from-fargo').hide();
$(this).addClass('has-file');
} else {
$(base_widget).find('.fileinfo').hide();
$(this).addClass('has-no-file');
}
$(this).find('input[type=file]').fileupload({
dropZone: base_widget,
@ -26,6 +28,7 @@ $(function() {
$(base_widget).parents('form').find('input[name=submit]').prop('disabled', false);
$(this).hide();
$(base_widget).find('.use-file-from-fargo').hide();
$(base_widget).addClass('has-file').removeClass('has-no-file');
},
progress: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
@ -37,6 +40,7 @@ $(function() {
$(base_widget).find('.fileinfo').hide();
$(base_widget).find('input[type=file]').show();
$(base_widget).find('.use-file-from-fargo').show();
$(base_widget).removeClass('has-file').addClass('has-no-file');
return false;
});
$(this).find('a.change').click(function() {