blob: 39f33489f2e2966d43fbf7184905ed5f6d2ed930 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
package Reaction::UI::Widget::Data;
use Reaction::UI::WidgetClass;
use namespace::clean -except => [qw(meta)];
extends 'Reaction::UI::Widget::Container';
before fragment widget {
my $data = $_{viewport}->args;
arg $_ => $data->{$_} for keys %$data;
};
1;
__END__
=head1 NAME
Reaction::UI::Widget::Data - Abstract class to render a data hash reference
=head1 DESCRIPTION
This takes the C<args> method return value of the viewport and populates the
arguments with names and values from that value.
=head1 FRAGMENTS
=head2 widget
Sets an argument for every key and value in the viewport's C<args> method return
value (which is expected to be a hash reference).
=head1 EXAMPLE LAYOUT
Assuming this hash reference:
{ first_name => "Foo", last_name => "Bar" }
we can access it in a layout set like this:
=widget Data
=for layout widget
Hello [% last_name | html %], [% first_name | html %]!
=cut
=head1 AUTHORS
See L<Reaction::Class> for authors.
=head1 LICENSE
See L<Reaction::Class> for the license.
=cut
|