From: Moritz Bunkus Date: Fri, 13 Jan 2017 09:25:48 +0000 (+0100) Subject: ActionBar: ComboBox mit nur einem Eintrag wie Eintrag rendern X-Git-Tag: release-3.5.4~1325 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/commitdiff_plain/3cc1ebb7995720386bb845c266efa807e931df86 ActionBar: ComboBox mit nur einem Eintrag wie Eintrag rendern Das erleichtert, wenn man in einer ComboBox mehrere Einträge evtl. gar nicht anzeigt. Der Aufrufer muss dann nicht prüfen, ob er der ComboBox einen oder mehrere Einträge übergibt. --- diff --git a/SL/Layout/ActionBar/ComboBox.pm b/SL/Layout/ActionBar/ComboBox.pm index 9a545392f..555ae69b2 100644 --- a/SL/Layout/ActionBar/ComboBox.pm +++ b/SL/Layout/ActionBar/ComboBox.pm @@ -20,6 +20,9 @@ sub from_params { sub render { my ($first, @rest) = @{ $_[0]->actions }; + + return $first->render if !@rest; + $_[0]->p->html_tag('div', $_[0]->p->html_tag('div', $first->render . $_[0]->p->html_tag('span'), class => 'layout-actionbar-combobox-head') . $_[0]->p->html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'),