a262b5bebe2334173f1b8d2ec0da3e5af1dfb5f8
[kivitendo-erp.git] / SL / Layout / Split.pm
1 package SL::Layout::Split;
2
3 use strict;
4 use parent qw(SL::Layout::Base);
5
6 use SL::Presenter::Tag qw(html_tag);
7
8 use Rose::Object::MakeMethods::Generic (
9   'scalar'                => [ qw(left right) ],
10 );
11
12 sub sub_layouts {
13   @{ $_[0]->left || [] },
14   @{ $_[0]->right || [] },
15 }
16
17 sub pre_content {
18   my $left  = join '', map { $_->pre_content } @{ $_[0]->left  || [] };
19   my $right = join '', map { $_->pre_content } @{ $_[0]->right || [] };
20
21   html_tag('div', $left, class => 'layout-split-left')
22   .'<div class="layout-split-right">' . $right;
23 }
24
25 sub post_content {
26   my $left  = join '', map { $_->post_content } @{ $_[0]->left  || [] };
27   my $right = join '', map { $_->post_content } @{ $_[0]->right || [] };
28
29   $right . '</div>'
30   . html_tag('div', $left, class => 't-layout-left');
31 }
32
33 1;
34
35 __END__
36
37 =encoding utf-8
38
39 =head1 NAME
40
41 SL::Layout::Split
42
43 =head1 SYNOPSIS
44
45   use SL::Layout::Split;
46
47   SL::Layout::Split->new(
48     left  => [ LIST OF SUBLAYOUTS ],
49     right => [ LIST OF SUBLAYOUTS ],
50   );
51
52 =head1 DESCRIPTION
53
54 Layout with left and right components, with content being part of the
55 right block.
56
57 =head1 BUGS
58
59 Due to the way content is serialized it's currently not possible to shift the content into the other blocks
60
61 =head1 AUTHOR
62
63 Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>
64
65 =cut