X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ccf94c5dca76b164beeba398d4c493018a9b535b..e0a3b19e35aed6f3f8ba84e25381a5d0e6ca61f4:/SL/Layout/ActionBar.pm diff --git a/SL/Layout/ActionBar.pm b/SL/Layout/ActionBar.pm index 3d9e4093a..edbd44e8d 100644 --- a/SL/Layout/ActionBar.pm +++ b/SL/Layout/ActionBar.pm @@ -3,6 +3,8 @@ package SL::Layout::ActionBar; use strict; use parent qw(SL::Layout::Base); +use SL::Layout::ActionBar::Action; + use constant HTML_CLASS => 'layout-actionbar'; use Rose::Object::MakeMethods::Generic ( @@ -13,22 +15,30 @@ use Rose::Object::MakeMethods::Generic ( ###### Layout overrides sub pre_content { - $::request->presenter->html_tag('div', '', class => HTML_CLASS); + my ($self) = @_; + + my $content = join '', map { $_->render } @{ $self->actions }; + $::request->presenter->html_tag('div', $content, class => HTML_CLASS); } -sub inline_javascript { - # data for bar +sub javascripts_inline { + join '', map { $_->script } @{ $_[0]->actions }; } sub javascripts { - + 'kivi.ActionBar.js' } ###### interface sub add_actions { my ($self, @actions) = @_; - push @{ $self->actions }, @actions; + push @{ $self->actions }, map { + !ref $_ ? SL::Layout::ActionBar::Action->from_descriptor($_) + : ref $_ && 'ARRAY' eq ref $_ ? SL::Layout::ActionBar::Action->simple($_) + : ref $_ && $_->isa('SL::Layout::Action') ? $_ + : do { die 'invalid action' }; + } @actions; } sub init_actions { @@ -93,7 +103,7 @@ Dispatches each each argument to C This is accessable through - $::request->layout->actionbar + $::request->layout->get('actionbar') =head1 DOM MODEL