From 43499432a57a1d92be93c5833fcfaf3ef0830c50 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 4 Feb 2019 12:27:34 +0100 Subject: [PATCH] Elastic: Fix height of select elements inside of composite fields also make them pretty when added programatically. --- program/js/app.js | 2 ++ program/steps/addressbook/func.inc | 12 ++++++++---- skins/elastic/styles/widgets/forms.less | 4 +++- skins/elastic/ui.js | 7 ++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 57726a026..66eea0ef6 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -6850,6 +6850,8 @@ function rcube_webmail() else if (colprop.type == 'composite') { var i, childcol, cp, first, templ, cols = [], suffices = [], content = cell; + row.addClass('composite'); + if (compact) content = $('
'); diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 4b1bd74a8..bdc513937 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -745,11 +745,15 @@ function rcmail_contact_form($form, $record, $attrib = null) } $colprop['id'] = 'ff_' . $col . intval($coltypes[$field]['count']); + $row_class = 'row'; // render composite field if ($colprop['type'] == 'composite') { - $composite = array(); $j = 0; - $template = $RCMAIL->config->get($col . '_template', '{'.join('} {', array_keys($colprop['childs'])).'}'); + $row_class .= ' composite'; + $composite = array(); + $template = $RCMAIL->config->get($col . '_template', '{'.join('} {', array_keys($colprop['childs'])).'}'); + $j = 0; + foreach ($colprop['childs'] as $childcol => $cp) { if (!empty($val) && is_array($val)) { $childvalue = $val[$childcol] ?: $val[$j]; @@ -847,11 +851,11 @@ function rcmail_contact_form($form, $record, $attrib = null) $val .= $_del_btn; } - $rows .= html::div('row', $_label . $val); + $rows .= html::div($row_class, $_label . $val); } // row without label else { - $rows .= html::div('row', $compact ? $val : html::div('contactfield', $val)); + $rows .= html::div($row_class, $compact ? $val : html::div('contactfield', $val)); } } diff --git a/skins/elastic/styles/widgets/forms.less b/skins/elastic/styles/widgets/forms.less index 010a830d0..801da0882 100644 --- a/skins/elastic/styles/widgets/forms.less +++ b/skins/elastic/styles/widgets/forms.less @@ -177,7 +177,6 @@ input.smart-upload { & > *:first-child { .overflow-ellipsis; min-width: 8rem; - height: auto; &:not(select) { padding: 0; @@ -204,6 +203,9 @@ input.smart-upload { select { text-align: left; + } + + &.composite select { height: auto; } diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index f7520ac9a..f2309f951 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -736,7 +736,12 @@ function rcube_elastic_ui() // Add date format placeholder to datepicker inputs var func, format = rcmail.env.date_format_localized; if (format) { - func = function(input) { $(input).filter('.datepicker').attr('placeholder', format); }; + func = function(input) { + $(input).filter('.datepicker').attr('placeholder', format); + // also make selects pretty + $(input).parent().find('select').each(function() { pretty_select(this); }); + }; + $('input.datepicker').each(function() { func(this); }); rcmail.addEventListener('insert-edit-field', func); }