Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5a55ac86

Von Sven Schöling vor etwa 7 Jahren hinzugefügt

  • ID 5a55ac869e35f61a8ae018d0e54b4fe6dc89c6a7
  • Vorgänger 0e5e3501
  • Nachfolger 6ef53d3f

Presenter: Neue Struktur im Layout umgesetzt

Unterschiede anzeigen:

SL/Layout/ActionBar.pm
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 (
......
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 {
SL/Layout/ActionBar/Action.pm
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) ],
......
# 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;
SL/Layout/ActionBar/ComboBox.pm
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) ],
......
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',
);
SL/Layout/ActionBar/Link.pm
use strict;
use parent qw(SL::Layout::ActionBar::Action);
use SL::Presenter::Tag qw(html_tag);
sub from_params {
my ($class, $data) = @_;
......
sub render {
my ($self) = @_;
return $self->p->html_tag(
html_tag(
'div', $self->text,
id => $self->id,
class => 'layout-actionbar-action layout-actionbar-link',
SL/Layout/ActionBar/Separator.pm
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 {
SL/Layout/ActionBar/Submit.pm
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',
);
SL/Layout/Content.pm
use strict;
use parent qw(SL::Layout::Base);
use SL::Presenter;
sub start_content {
"<div id='content'>";
}
SL/Layout/Split.pm
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) ],
......
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')
.'<div class="layout-split-right">' . $right;
}
......
my $right = join '', map { $_->post_content } @{ $_[0]->right || [] };
$right . '</div>'
. SL::Presenter->get->html_tag('div', $left, class => 't-layout-left');
. html_tag('div', $left, class => 't-layout-left');
}
1;

Auch abrufbar als: Unified diff