manager: recompute cell edition height after submit (#29244)

This commit is contained in:
Frédéric Péters 2018-12-20 11:45:43 +01:00
parent eed3f2c1a8
commit 1734663870
1 changed files with 12 additions and 5 deletions

View File

@ -205,6 +205,7 @@ $(function() {
/* update form with new content, unless it has a ckeditor, as
* this causes an unpleasant flickering */
$button.parents('form').find('div.cell-form').html(data);
compute_max_height($form.parents('div.cell'));
}
$form.parents('div.cell').trigger('combo:cellform-reloaded');
if (data.indexOf('class="errorlist"') == -1) {
@ -219,13 +220,19 @@ $(function() {
return false;
});
function compute_max_height($cell) {
var cell_id = $cell.attr('id');
$('style#for-' + cell_id).remove();
var h = $cell.find('h3 + div').height() + 40;
h += $cell.find('.multisort').length * 250;
h += $cell.find('.django-ckeditor-widget').length * 200;
var style = '<style id="for-' + cell_id + '">div#' + cell_id + '.toggled h3 + div { max-height: '+h+'px; }</style>';
$(style).appendTo('head');
}
$('div.cell').each(function(i, x) {
$(this).attr('id', 'div-cell-'+i);
var h = $(this).find('h3 + div').height() + 10;
h += $(this).find('.multisort').length * 250;
h += $(this).find('.django-ckeditor-widget').length * 200;
var style = '<style>div#div-cell-'+i+'.toggled h3 + div { max-height: '+h+'px; }</style>';
$(style).appendTo('head');
compute_max_height($(this));
$(this).addClass('untoggled');
});
$('#assets-browser table tr').on('hover mouseenter', function() {