From: Sven Schöling Date: Tue, 19 Dec 2017 14:27:35 +0000 (+0100) Subject: Presenter: Neue Struktur im Layout umgesetzt X-Git-Tag: release-3.5.4~565 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5a55ac869e35f61a8ae018d0e54b4fe6dc89c6a7;p=kivitendo-erp.git Presenter: Neue Struktur im Layout umgesetzt --- diff --git a/SL/Layout/ActionBar.pm b/SL/Layout/ActionBar.pm index 32c2f7d7e..cdd845be4 100644 --- a/SL/Layout/ActionBar.pm +++ b/SL/Layout/ActionBar.pm @@ -10,6 +10,8 @@ use SL::Layout::ActionBar::ComboBox; use SL::Layout::ActionBar::Link; use SL::Layout::ActionBar::Separator; +use SL::Presenter::Tag qw(html_tag); + use constant HTML_CLASS => 'layout-actionbar'; use Rose::Object::MakeMethods::Generic ( @@ -30,7 +32,7 @@ sub pre_content { my $content = join '', map { $_->render } @{ $self->actions }; return if !$content; - $::request->presenter->html_tag('div', $content, class => HTML_CLASS); + html_tag('div', $content, class => HTML_CLASS); } sub javascripts_inline { diff --git a/SL/Layout/ActionBar/Action.pm b/SL/Layout/ActionBar/Action.pm index 90eb8498c..aea2e2cf0 100644 --- a/SL/Layout/ActionBar/Action.pm +++ b/SL/Layout/ActionBar/Action.pm @@ -3,7 +3,7 @@ package SL::Layout::ActionBar::Action; use strict; use parent qw(Rose::Object); -use SL::Presenter; +use SL::Presenter::Tag qw(name_to_id); use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(id params text) ], @@ -35,18 +35,13 @@ sub callable { 0 } # shortcut for presenter -sub p { - SL::Presenter->get -} - sub init_params { +{} } # unique id to tie div and javascript together sub init_id { - $_[0]->params->{id} // - $_[0]->p->name_to_id('action[]') + $_[0]->params->{id} // name_to_id('action[]') } 1; diff --git a/SL/Layout/ActionBar/ComboBox.pm b/SL/Layout/ActionBar/ComboBox.pm index 0ff0bc10d..477151dbc 100644 --- a/SL/Layout/ActionBar/ComboBox.pm +++ b/SL/Layout/ActionBar/ComboBox.pm @@ -5,6 +5,7 @@ use parent qw(SL::Layout::ActionBar::Action); use JSON; use List::MoreUtils qw(none); +use SL::Presenter::Tag qw(html_tag); use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(actions) ], @@ -25,9 +26,9 @@ sub render { return if none { $_->callable } @{ $_[0]->actions }; return $first->render if !@rest; - $_[0]->p->html_tag('div', - $_[0]->p->html_tag('div', $first->render . $_[0]->p->html_tag('span'), class => 'layout-actionbar-combobox-head') . - $_[0]->p->html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'), + html_tag('div', + html_tag('div', $first->render . html_tag('span'), class => 'layout-actionbar-combobox-head') . + html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'), id => $_[0]->id, class => 'layout-actionbar-combobox', ); diff --git a/SL/Layout/ActionBar/Link.pm b/SL/Layout/ActionBar/Link.pm index e6df8b2ea..5e47663cd 100644 --- a/SL/Layout/ActionBar/Link.pm +++ b/SL/Layout/ActionBar/Link.pm @@ -3,6 +3,8 @@ package SL::Layout::ActionBar::Link; use strict; use parent qw(SL::Layout::ActionBar::Action); +use SL::Presenter::Tag qw(html_tag); + sub from_params { my ($class, $data) = @_; @@ -16,7 +18,7 @@ sub from_params { sub render { my ($self) = @_; - return $self->p->html_tag( + html_tag( 'div', $self->text, id => $self->id, class => 'layout-actionbar-action layout-actionbar-link', diff --git a/SL/Layout/ActionBar/Separator.pm b/SL/Layout/ActionBar/Separator.pm index cbcdf5119..afa202e8f 100644 --- a/SL/Layout/ActionBar/Separator.pm +++ b/SL/Layout/ActionBar/Separator.pm @@ -3,10 +3,12 @@ package SL::Layout::ActionBar::Separator; use strict; use parent qw(SL::Layout::ActionBar::Action); +use SL::Presenter::Tag qw(html_tag); + sub from_params { $_[0]->new } sub render { - $_[0]->p->html_tag('div', '', class => 'layout-actionbar-separator'); + html_tag('div', '', class => 'layout-actionbar-separator'); } sub script { diff --git a/SL/Layout/ActionBar/Submit.pm b/SL/Layout/ActionBar/Submit.pm index a130209e9..f3288c7d9 100644 --- a/SL/Layout/ActionBar/Submit.pm +++ b/SL/Layout/ActionBar/Submit.pm @@ -3,8 +3,10 @@ package SL::Layout::ActionBar::Submit; use strict; use parent qw(SL::Layout::ActionBar::Action); +use SL::Presenter::Tag qw(html_tag); + sub render { - $_[0]->p->html_tag('div', $_[0]->text, + html_tag('div', $_[0]->text, id => $_[0]->id, class => 'layout-actionbar-action layout-actionbar-submit', ); diff --git a/SL/Layout/Content.pm b/SL/Layout/Content.pm index 6bf726777..8e0549bfe 100644 --- a/SL/Layout/Content.pm +++ b/SL/Layout/Content.pm @@ -3,8 +3,6 @@ package SL::Layout::Content; use strict; use parent qw(SL::Layout::Base); -use SL::Presenter; - sub start_content { "
"; } diff --git a/SL/Layout/Split.pm b/SL/Layout/Split.pm index 5b5484076..dec8bfd52 100644 --- a/SL/Layout/Split.pm +++ b/SL/Layout/Split.pm @@ -3,7 +3,7 @@ package SL::Layout::Split; use strict; use parent qw(SL::Layout::Base); -use SL::Presenter; +use SL::Presenter::Tag qw(html_tag); use Rose::Object::MakeMethods::Generic ( 'scalar' => [ qw(left right) ], @@ -18,7 +18,7 @@ sub pre_content { my $left = join '', map { $_->pre_content } @{ $_[0]->left || [] }; my $right = join '', map { $_->pre_content } @{ $_[0]->right || [] }; - SL::Presenter->get->html_tag('div', $left, class => 'layout-split-left') + html_tag('div', $left, class => 'layout-split-left') .'
' . $right; } @@ -27,7 +27,7 @@ sub post_content { my $right = join '', map { $_->post_content } @{ $_[0]->right || [] }; $right . '
' - . SL::Presenter->get->html_tag('div', $left, class => 't-layout-left'); + . html_tag('div', $left, class => 't-layout-left'); } 1;