A .propform table with more plain text rows than input rows is considered .text-only

pull/5742/merge
Aleksander Machniak 7 years ago
parent 35f7d2862f
commit 975612581d

@ -583,7 +583,7 @@ function rcube_elastic_ui()
$('input:not(.button,[type=file],[type=radio],[type=checkbox]),select,textarea', $('.propform', context)).addClass('form-control'); $('input:not(.button,[type=file],[type=radio],[type=checkbox]),select,textarea', $('.propform', context)).addClass('form-control');
$('[type=checkbox]', $('.propform', context)).addClass('form-check-input'); $('[type=checkbox]', $('.propform', context)).addClass('form-check-input');
$('table.propform', context).each(function() { $('table.propform', context).each(function() {
var text_only = true; var text_rows = 0, form_rows = 0;
$(this).find('> tbody > tr').each(function() { $(this).find('> tbody > tr').each(function() {
var first, last, row = $(this), var first, last, row = $(this),
@ -605,13 +605,14 @@ function rcube_elastic_ui()
row_classes.push('with-link'); row_classes.push('with-link');
} }
text_only = false; form_rows++;
} }
else if (!last.find('input:not([type=hidden]),textarea,radio,select').length) { else if (!last.find('input:not([type=hidden]),textarea,radio,select').length) {
last.addClass('form-control-plaintext'); last.addClass('form-control-plaintext');
text_rows++;
} }
else { else {
text_only = false; form_rows++;
} }
// style some multi-input fields // style some multi-input fields
@ -626,7 +627,7 @@ function rcube_elastic_ui()
row.addClass(row_classes.join(' ')); row.addClass(row_classes.join(' '));
}); });
if (text_only) { if (text_rows > form_rows) {
$(this).addClass('text-only'); $(this).addClass('text-only');
} }
}); });

Loading…
Cancel
Save