From 9ad27e65cc381fdba086a926e83ef5789dff7a86 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 14 Mar 2013 13:18:04 +0100 Subject: [PATCH] Layout auf Presenter umgestellt. Behebt circular includes von SL::Layout::Base -> SL::Controller::Base -> SL::Request -> SL::Layout::Base --- SL/Layout/Base.pm | 7 ++++++- SL/Layout/Javascript.pm | 2 +- SL/Layout/MenuLeft.pm | 2 +- SL/Layout/None.pm | 4 ++-- SL/Layout/Top.pm | 2 +- SL/Layout/V3.pm | 2 +- t/controllers/base/render.t | 2 ++ 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/SL/Layout/Base.pm b/SL/Layout/Base.pm index bd08d8164..72b4876db 100644 --- a/SL/Layout/Base.pm +++ b/SL/Layout/Base.pm @@ -1,7 +1,7 @@ package SL::Layout::Base; use strict; -use parent qw(SL::Controller::Base); +use parent qw(Rose::Object); use List::MoreUtils qw(uniq); use Time::HiRes qw(); @@ -18,6 +18,7 @@ use Rose::Object::MakeMethods::Generic ( ); use SL::Menu; +use SL::Presenter; my %menu_cache; @@ -154,4 +155,8 @@ sub need_footer { $_[0]{_header_done}; } +sub presenter { + SL::Presenter->get; +} + 1; diff --git a/SL/Layout/Javascript.pm b/SL/Layout/Javascript.pm index 2cda0f459..b08cf6dcc 100644 --- a/SL/Layout/Javascript.pm +++ b/SL/Layout/Javascript.pm @@ -47,7 +47,7 @@ sub display { $callback = URI->new($callback)->rel($callback) if $callback; $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/; - $self->render("menu/menunew", { output => 0 }, + $self->presenter->render("menu/menunew", force_ul_width => 1, date => $self->clock_line, menu_items => $self->acc_menu, diff --git a/SL/Layout/MenuLeft.pm b/SL/Layout/MenuLeft.pm index d740640c6..9a47d292d 100644 --- a/SL/Layout/MenuLeft.pm +++ b/SL/Layout/MenuLeft.pm @@ -15,7 +15,7 @@ sub javascripts_inline { my $self = shift; $self->SUPER::javascripts_inline; my $sections = [ section_menu($self->menu) ]; - $self->render('menu/menu', { output => 0 }, + $self->presenter->render('menu/menu', sections => $sections, ) } diff --git a/SL/Layout/None.pm b/SL/Layout/None.pm index 971ef857a..4a02d652a 100644 --- a/SL/Layout/None.pm +++ b/SL/Layout/None.pm @@ -14,9 +14,9 @@ sub javascripts_inline { s/y+/yy/gi; } $::myconfig{dateformat}; - return $self->render( + return $self->presenter->render( 'layout/javascript_setup', - { type => 'js', output => 0, }, + { type => 'js' }, datefmt => $datefmt, focus => $::request->layout->focus, ajax_spinner => 1, diff --git a/SL/Layout/Top.pm b/SL/Layout/Top.pm index 9c4fdea36..a838aeee1 100644 --- a/SL/Layout/Top.pm +++ b/SL/Layout/Top.pm @@ -6,7 +6,7 @@ use parent qw(SL::Layout::Base); sub pre_content { my ($self) = @_; - $self->SUPER::render('menu/header', { output => 0 }, + $self->presenter->render('menu/header', now => DateTime->now_local, is_fastcgi => scalar($::dispatcher->interface_type =~ /fastcgi/i), is_links => scalar($ENV{HTTP_USER_AGENT} =~ /links/i)); diff --git a/SL/Layout/V3.pm b/SL/Layout/V3.pm index 9d5e37d86..03c6f3ebf 100644 --- a/SL/Layout/V3.pm +++ b/SL/Layout/V3.pm @@ -164,7 +164,7 @@ sub render { $callback = URI->new($callback)->rel($callback) if $callback; $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/; - $self->SUPER::render('menu/menuv3', { output => 0 }, + $self->presenter->render('menu/menuv3', force_ul_width => 1, date => $self->clock_line, menu => $self->print_menu, diff --git a/t/controllers/base/render.t b/t/controllers/base/render.t index 0f252bbe2..0a15078e0 100644 --- a/t/controllers/base/render.t +++ b/t/controllers/base/render.t @@ -7,6 +7,8 @@ use lib 't'; use Support::TestSetup; use SL::Presenter; +use SL::Controller::Base; +use SL::Layout::Javascript; no warnings 'uninitialized'; -- 2.20.1