1 package SL::Layout::ActionBar::ComboBox;
4 use parent qw(SL::Layout::ActionBar::Action);
7 use List::MoreUtils qw(none);
8 use SL::Presenter::Tag qw(html_tag);
10 use Rose::Object::MakeMethods::Generic (
11 'scalar --get_set_init' => [ qw(actions) ],
15 my ($class, $actions) = @_;
17 my $combobox = $class->new;
18 push @{ $combobox->actions }, SL::Layout::ActionBar->parse_actions(@{ $actions });
24 my ($first, @rest) = @{ $_[0]->actions };
26 return if none { $_->callable } @{ $_[0]->actions };
27 return $first->render if !@rest;
30 html_tag('div', $first->render . html_tag('span'), class => 'layout-actionbar-combobox-head') .
31 html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'),
33 class => 'layout-actionbar-combobox',
38 map { $_->script } @{ $_[0]->actions }
41 sub init_actions { [] }