Revision 5a55ac86
Von Sven Schöling vor etwa 7 Jahren hinzugefügt
SL/Layout/ActionBar.pm | ||
---|---|---|
10 | 10 |
use SL::Layout::ActionBar::Link; |
11 | 11 |
use SL::Layout::ActionBar::Separator; |
12 | 12 |
|
13 |
use SL::Presenter::Tag qw(html_tag); |
|
14 |
|
|
13 | 15 |
use constant HTML_CLASS => 'layout-actionbar'; |
14 | 16 |
|
15 | 17 |
use Rose::Object::MakeMethods::Generic ( |
... | ... | |
30 | 32 |
|
31 | 33 |
my $content = join '', map { $_->render } @{ $self->actions }; |
32 | 34 |
return if !$content; |
33 |
$::request->presenter->html_tag('div', $content, class => HTML_CLASS);
|
|
35 |
html_tag('div', $content, class => HTML_CLASS); |
|
34 | 36 |
} |
35 | 37 |
|
36 | 38 |
sub javascripts_inline { |
SL/Layout/ActionBar/Action.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
use parent qw(Rose::Object); |
5 | 5 |
|
6 |
use SL::Presenter; |
|
6 |
use SL::Presenter::Tag qw(name_to_id);
|
|
7 | 7 |
|
8 | 8 |
use Rose::Object::MakeMethods::Generic ( |
9 | 9 |
'scalar --get_set_init' => [ qw(id params text) ], |
... | ... | |
35 | 35 |
|
36 | 36 |
# shortcut for presenter |
37 | 37 |
|
38 |
sub p { |
|
39 |
SL::Presenter->get |
|
40 |
} |
|
41 |
|
|
42 | 38 |
sub init_params { |
43 | 39 |
+{} |
44 | 40 |
} |
45 | 41 |
|
46 | 42 |
# unique id to tie div and javascript together |
47 | 43 |
sub init_id { |
48 |
$_[0]->params->{id} // |
|
49 |
$_[0]->p->name_to_id('action[]') |
|
44 |
$_[0]->params->{id} // name_to_id('action[]') |
|
50 | 45 |
} |
51 | 46 |
|
52 | 47 |
1; |
SL/Layout/ActionBar/ComboBox.pm | ||
---|---|---|
5 | 5 |
|
6 | 6 |
use JSON; |
7 | 7 |
use List::MoreUtils qw(none); |
8 |
use SL::Presenter::Tag qw(html_tag); |
|
8 | 9 |
|
9 | 10 |
use Rose::Object::MakeMethods::Generic ( |
10 | 11 |
'scalar --get_set_init' => [ qw(actions) ], |
... | ... | |
25 | 26 |
return if none { $_->callable } @{ $_[0]->actions }; |
26 | 27 |
return $first->render if !@rest; |
27 | 28 |
|
28 |
$_[0]->p->html_tag('div',
|
|
29 |
$_[0]->p->html_tag('div', $first->render . $_[0]->p->html_tag('span'), class => 'layout-actionbar-combobox-head') .
|
|
30 |
$_[0]->p->html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'),
|
|
29 |
html_tag('div', |
|
30 |
html_tag('div', $first->render . html_tag('span'), class => 'layout-actionbar-combobox-head') .
|
|
31 |
html_tag('div', join('', map { $_->render } @rest), class => 'layout-actionbar-combobox-list'), |
|
31 | 32 |
id => $_[0]->id, |
32 | 33 |
class => 'layout-actionbar-combobox', |
33 | 34 |
); |
SL/Layout/ActionBar/Link.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
use parent qw(SL::Layout::ActionBar::Action); |
5 | 5 |
|
6 |
use SL::Presenter::Tag qw(html_tag); |
|
7 |
|
|
6 | 8 |
sub from_params { |
7 | 9 |
my ($class, $data) = @_; |
8 | 10 |
|
... | ... | |
16 | 18 |
sub render { |
17 | 19 |
my ($self) = @_; |
18 | 20 |
|
19 |
return $self->p->html_tag(
|
|
21 |
html_tag( |
|
20 | 22 |
'div', $self->text, |
21 | 23 |
id => $self->id, |
22 | 24 |
class => 'layout-actionbar-action layout-actionbar-link', |
SL/Layout/ActionBar/Separator.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
use parent qw(SL::Layout::ActionBar::Action); |
5 | 5 |
|
6 |
use SL::Presenter::Tag qw(html_tag); |
|
7 |
|
|
6 | 8 |
sub from_params { $_[0]->new } |
7 | 9 |
|
8 | 10 |
sub render { |
9 |
$_[0]->p->html_tag('div', '', class => 'layout-actionbar-separator');
|
|
11 |
html_tag('div', '', class => 'layout-actionbar-separator'); |
|
10 | 12 |
} |
11 | 13 |
|
12 | 14 |
sub script { |
SL/Layout/ActionBar/Submit.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
use parent qw(SL::Layout::ActionBar::Action); |
5 | 5 |
|
6 |
use SL::Presenter::Tag qw(html_tag); |
|
7 |
|
|
6 | 8 |
sub render { |
7 |
$_[0]->p->html_tag('div', $_[0]->text,
|
|
9 |
html_tag('div', $_[0]->text, |
|
8 | 10 |
id => $_[0]->id, |
9 | 11 |
class => 'layout-actionbar-action layout-actionbar-submit', |
10 | 12 |
); |
SL/Layout/Content.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
use parent qw(SL::Layout::Base); |
5 | 5 |
|
6 |
use SL::Presenter; |
|
7 |
|
|
8 | 6 |
sub start_content { |
9 | 7 |
"<div id='content'>"; |
10 | 8 |
} |
SL/Layout/Split.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
use parent qw(SL::Layout::Base); |
5 | 5 |
|
6 |
use SL::Presenter; |
|
6 |
use SL::Presenter::Tag qw(html_tag);
|
|
7 | 7 |
|
8 | 8 |
use Rose::Object::MakeMethods::Generic ( |
9 | 9 |
'scalar' => [ qw(left right) ], |
... | ... | |
18 | 18 |
my $left = join '', map { $_->pre_content } @{ $_[0]->left || [] }; |
19 | 19 |
my $right = join '', map { $_->pre_content } @{ $_[0]->right || [] }; |
20 | 20 |
|
21 |
SL::Presenter->get->html_tag('div', $left, class => 'layout-split-left')
|
|
21 |
html_tag('div', $left, class => 'layout-split-left') |
|
22 | 22 |
.'<div class="layout-split-right">' . $right; |
23 | 23 |
} |
24 | 24 |
|
... | ... | |
27 | 27 |
my $right = join '', map { $_->post_content } @{ $_[0]->right || [] }; |
28 | 28 |
|
29 | 29 |
$right . '</div>' |
30 |
. SL::Presenter->get->html_tag('div', $left, class => 't-layout-left');
|
|
30 |
. html_tag('div', $left, class => 't-layout-left'); |
|
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
1; |
Auch abrufbar als: Unified diff
Presenter: Neue Struktur im Layout umgesetzt