cartads: don't display initial file widget for specific pieces (#35337)

This commit is contained in:
Frédéric Péters 2019-09-17 11:23:39 +02:00
parent 826df49d4e
commit 2d0b749e17
2 changed files with 22 additions and 1 deletions

View File

@ -23,3 +23,19 @@ div.cartads-piece {
}
}
}
div.pieces-specifiques ~ div.cartads-piece {
// for specific pieces don't display initial widget
div.title + div.file-upload-widget {
display: none;
}
div.title + div.file-upload-widget.visible {
display: block;
}
div.title + div.file-upload-widget:not(.visible) + div.button-plus {
button {
margin-top: 0;
margin-bottom: 2rem;
}
}
}

View File

@ -21,7 +21,12 @@ $('.file-upload-widget input[type=file]').on('change', $.CartaDs.change);
$('.file-upload-widget.has-file input[type=file]').each($.CartaDs.change);
$('button.plus').on('click', function() {
var $file_button = $(this).parent().prev().clone();
var $orig_file_button = $(this).parent().prev();
if (! $orig_file_button.is(':visible')) {
$orig_file_button.addClass('visible');
return false;
}
var $file_button = $orig_file_button.clone();
$file_button.find('div.title').remove();
$file_button.find('input[type=hidden]').val('');
$file_button.find('.fileinfo').hide();