X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLayout%2FActionBar%2FComboBox.pm;h=477151dbc9e1929b939bd90754cf1391f7fa2295;hb=dc7162f360873e40872e43bb3be4cc69f4833461;hp=9a545392f37cdd33e69995d4944a47d9735fb6ed;hpb=ff424b75f8f66c796eae294d0239f0440741e578;p=kivitendo-erp.git diff --git a/SL/Layout/ActionBar/ComboBox.pm b/SL/Layout/ActionBar/ComboBox.pm index 9a545392f..477151dbc 100644 --- a/SL/Layout/ActionBar/ComboBox.pm +++ b/SL/Layout/ActionBar/ComboBox.pm @@ -4,6 +4,8 @@ use strict; use parent qw(SL::Layout::ActionBar::Action); use JSON; +use List::MoreUtils qw(none); +use SL::Presenter::Tag qw(html_tag); use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(actions) ], @@ -20,9 +22,13 @@ sub from_params { sub render { my ($first, @rest) = @{ $_[0]->actions }; - $_[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'), + + return if none { $_->callable } @{ $_[0]->actions }; + return $first->render if !@rest; + + html_tag('div', + html_tag('div', $first->render . html_tag('span'), class => 'layout-actionbar-combobox-head') . + html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'), id => $_[0]->id, class => 'layout-actionbar-combobox', );