1 package SL::Layout::ActionBar::ComboBox;
4 use parent qw(SL::Layout::ActionBar::Action);
7 use List::MoreUtils qw(none);
9 use Rose::Object::MakeMethods::Generic (
10 'scalar --get_set_init' => [ qw(actions) ],
14 my ($class, $actions) = @_;
16 my $combobox = $class->new;
17 push @{ $combobox->actions }, SL::Layout::ActionBar->parse_actions(@{ $actions });
23 my ($first, @rest) = @{ $_[0]->actions };
25 return if none { $_->callable } @{ $_[0]->actions };
26 return $first->render if !@rest;
28 $_[0]->p->html_tag('div',
29 $_[0]->p->html_tag('div', $first->render . $_[0]->p->html_tag('span'), class => 'layout-actionbar-combobox-head') .
30 $_[0]->p->html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'),
32 class => 'layout-actionbar-combobox',
37 map { $_->script } @{ $_[0]->actions }
40 sub init_actions { [] }