From: Sven Schöling Date: Tue, 16 Oct 2012 18:22:58 +0000 (+0200) Subject: init_sub_layouts ist sauberer X-Git-Tag: release-3.0.0beta1~116 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=8bed51b59d52822ce4803fe18597c69ee3306183;p=kivitendo-erp.git init_sub_layouts ist sauberer --- diff --git a/SL/Layout/Admin.pm b/SL/Layout/Admin.pm index 188655fae..00e312540 100644 --- a/SL/Layout/Admin.pm +++ b/SL/Layout/Admin.pm @@ -3,16 +3,8 @@ package SL::Layout::Admin; use strict; use parent qw(SL::Layout::Base); -sub new { - my ($class, @slurp) = @_; - - my $self = $class->SUPER::new(@slurp); - - $self->add_sub_layouts([ - SL::Layout::None->new, - ]); - - $self; +sub init_sub_layouts { + [ SL::Layout::None->new ] } sub start_content { diff --git a/SL/Layout/Base.pm b/SL/Layout/Base.pm index 18ef133e9..0c209e2af 100644 --- a/SL/Layout/Base.pm +++ b/SL/Layout/Base.pm @@ -11,8 +11,8 @@ use Rose::Object::MakeMethods::Generic ( 'array' => [ 'add_stylesheets_inline' => { interface => 'add', hash_key => 'stylesheets_inline' }, 'add_javascripts_inline' => { interface => 'add', hash_key => 'javascripts_inline' }, - 'sub_layouts', - 'add_sub_layouts' => { interface => 'add', hash_key => 'sub_layouts' }, + 'sub_layouts', => { interface => 'get_set_init' }, + 'add_sub_layouts' => { interface => 'add', hash_key => 'sub_layouts' }, ], ); @@ -60,6 +60,8 @@ sub javascripts_inline { @{ $_[0]->{javascripts_inline} || [] }; } +sub init_sub_layouts { [] } + ######################################### # Interface diff --git a/SL/Layout/Classic.pm b/SL/Layout/Classic.pm index a2ef7702d..9503d05fe 100644 --- a/SL/Layout/Classic.pm +++ b/SL/Layout/Classic.pm @@ -5,19 +5,14 @@ use parent qw(SL::Layout::Base); use SL::Layout::Top; use SL::Layout::MenuLeft; +use SL::Layout::None; -sub new { - my ($class, @slurp) = @_; - - my $self = $class->SUPER::new(@slurp); - - $self->add_sub_layouts([ +sub init_sub_layouts { + [ SL::Layout::Top->new, SL::Layout::MenuLeft->new, SL::Layout::None->new, - ]); - - $self; + ] } 1; diff --git a/SL/Layout/Javascript.pm b/SL/Layout/Javascript.pm index 28731ec9e..d8f079fcf 100644 --- a/SL/Layout/Javascript.pm +++ b/SL/Layout/Javascript.pm @@ -6,16 +6,8 @@ use parent qw(SL::Layout::Base); use List::Util qw(max); use URI; -sub new { - my ($class, @slurp) = @_; - - my $self = $class->SUPER::new(@slurp); - - $self->add_sub_layouts([ - SL::Layout::None->new, - ]); - - $self; +sub init_sub_layouts { + [ SL::Layout::None->new ] } sub pre_content { diff --git a/SL/Layout/V3.pm b/SL/Layout/V3.pm index 78b498e97..4769c4062 100644 --- a/SL/Layout/V3.pm +++ b/SL/Layout/V3.pm @@ -6,16 +6,8 @@ use SL::Layout::Css; use URI; -sub new { - my ($class, @slurp) = @_; - - my $self = $class->SUPER::new(@slurp); - - $self->add_sub_layouts([ - SL::Layout::None->new, - ]); - - $self; +sub init_sub_layouts { + [ SL::Layout::None->new ] } sub pre_content { diff --git a/SL/Layout/V4.pm b/SL/Layout/V4.pm index fff1dfe0e..81789d466 100644 --- a/SL/Layout/V4.pm +++ b/SL/Layout/V4.pm @@ -7,15 +7,11 @@ use SL::Layout::Top; use URI; -sub new { - my ($class, @slurp) = @_; - - my $self = $class->SUPER::new(@slurp); - $self->add_sub_layouts( +sub init_sub_layouts { + [ SL::Layout::Top->new, SL::Layout::None->new, - ); - $self; + ] } sub start_content {