Commit | Line | Data |
e22de101 |
1 | package Reaction::UI::Widget::Value::Collection; |
2 | |
3 | use Reaction::UI::WidgetClass; |
4 | |
bae75bee |
5 | use namespace::clean -except => [ qw(meta) ]; |
aa8c0c90 |
6 | |
aa8c0c90 |
7 | |
bae75bee |
8 | before fragment widget { |
d219104c |
9 | arg 'label' => localized $_{viewport}->label; |
bae75bee |
10 | }; |
aa8c0c90 |
11 | |
bae75bee |
12 | implements fragment list { |
13 | render 'item' => over $_{viewport}->value_names; |
14 | }; |
aa8c0c90 |
15 | |
bae75bee |
16 | implements fragment item { |
d219104c |
17 | arg 'name' => localized $_; |
e22de101 |
18 | }; |
19 | |
bae75bee |
20 | __PACKAGE__->meta->make_immutable; |
21 | |
22 | |
e22de101 |
23 | 1; |
24 | |
25 | __END__; |
26 | |
27 | |
28 | =head1 NAME |
29 | |
30 | Reaction::UI::Widget::Value::Collection |
31 | |
32 | =head1 DESCRIPTION |
33 | |
f9b32c83 |
34 | This widget provides an additional C<label> argument for the C<widget> |
35 | fragment containing the localised value of the viewports C<label> attribute. |
36 | |
37 | It also implements the fragments C<list> and C<item>. |
38 | |
39 | =head1 FRAGMENTS AND LAYOUTS |
e22de101 |
40 | |
41 | =head2 widget |
42 | |
f9b32c83 |
43 | This will set the C<label> argument to the return value of the C<label> method |
44 | on the viewport. The base layout will then render the C<list> fragment. |
e22de101 |
45 | |
46 | =head2 list |
47 | |
f9b32c83 |
48 | This will render the C<item> fragment once for every entry in the viewports |
49 | C<value_names>. The base layout will surround the rendered output with a unordered |
50 | list. |
e22de101 |
51 | |
52 | =head2 item |
53 | |
f9b32c83 |
54 | This will set the argument C<name> to the localised value of the current iteration |
55 | (stored in C<$_>). The base layout will render a list item with the value as |
56 | html escaped content of the item. |
57 | |
58 | =head1 LAYOUT SETS |
59 | |
60 | share/skin/base/layout/value/collection.tt |
61 | share/skin/base/layout/value/list.tt |
e22de101 |
62 | |
63 | =head1 AUTHORS |
64 | |
65 | See L<Reaction::Class> for authors. |
66 | |
67 | =head1 LICENSE |
68 | |
69 | See L<Reaction::Class> for the license. |
70 | |
71 | =cut |