1 package SL::Layout::ActionBar;
4 use parent qw(SL::Layout::Base);
6 use SL::Layout::ActionBar::Action;
8 use constant HTML_CLASS => 'layout-actionbar';
10 use Rose::Object::MakeMethods::Generic (
11 'scalar --get_set_init' => [ qw(actions) ],
15 ###### Layout overrides
20 my $content = join '', map { $_->render } @{ $self->actions };
21 $::request->presenter->html_tag('div', $content, class => HTML_CLASS);
24 sub javascripts_inline {
25 join '', map { $_->script } @{ $_[0]->actions };
35 my ($self, @actions) = @_;
36 push @{ $self->actions }, map {
37 !ref $_ ? SL::Layout::ActionBar::Action->from_descriptor($_)
38 : ref $_ && 'ARRAY' eq ref $_ ? SL::Layout::ActionBar::Action->simple($_)
39 : ref $_ && $_->isa('SL::Layout::Action') ? $_
40 : do { die 'invalid action' };
59 SL::Layout::ActionBar - Unified action buttons for controllers
63 This is a layout block that does a unified action bar for any controller who
64 wants to use it. It's designed to be rendered above the content and to be
67 While it can be used as a generic widget container, it's designed to be able to
68 provide commonly used functionality as a short cut. These shortcuts include:
74 Calling a controller with parameters
78 Submitting a form with added parameters
91 =item C<add_actions LIST>
93 Dispatches each each argument to C<add_action>
98 =item C<add_separator>
102 =head1 ACCESS FROM CODE
104 This is accessable through
106 $::request->layout->get('actionbar')
110 The entire block is rendered into a div with the class 'layout-actionbar'.
112 =head1 ACTION WIDGETS
114 Each individual action must be an instance of C<SL::Layout::ActionBar::Action>.
122 Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>