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 };
22 $::request->presenter->html_tag('div', $content, class => HTML_CLASS);
25 sub javascripts_inline {
26 join '', map { $_->script } @{ $_[0]->actions };
36 my ($self, @actions) = @_;
37 push @{ $self->actions }, map {
38 !ref $_ ? SL::Layout::ActionBar::Action->from_descriptor($_)
39 : ref $_ && 'ARRAY' eq ref $_ ? SL::Layout::ActionBar::Action->simple($_)
40 : ref $_ && $_->isa('SL::Layout::Action') ? $_
41 : do { die 'invalid action' };
60 SL::Layout::ActionBar - Unified action buttons for controllers
64 This is a layout block that does a unified action bar for any controller who
65 wants to use it. It's designed to be rendered above the content and to be
68 While it can be used as a generic widget container, it's designed to be able to
69 provide commonly used functionality as a short cut. These shortcuts include:
75 Calling a controller with parameters
79 Submitting a form with added parameters
92 =item C<add_actions LIST>
94 Dispatches each each argument to C<add_action>
99 =item C<add_separator>
103 =head1 ACCESS FROM CODE
105 This is accessable through
107 $::request->layout->get('actionbar')
111 The entire block is rendered into a div with the class 'layout-actionbar'.
113 =head1 ACTION WIDGETS
115 Each individual action must be an instance of C<SL::Layout::ActionBar::Action>.
123 Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>