search spec components factored out of T365
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Value.pm
1 package Reaction::UI::Widget::Value;
2
3 use Reaction::UI::WidgetClass;
4
5 use namespace::clean -except => [ qw(meta) ];
6
7
8 before fragment widget {
9   if ($_{viewport}->can('value_string')) {
10     arg value => $_{viewport}->value_string;
11   } elsif($_{viewport}->can('value')) {
12     arg value => $_{viewport}->value;
13   }
14 };
15
16 __PACKAGE__->meta->make_immutable;
17
18
19 1;
20
21 __END__;
22
23 =head1 NAME
24
25 Reaction::UI::Widget::Value
26
27 =head1 DESCRIPTION
28
29 This widget provides the return value of the C<vlues_string> or C<value>
30 method on the viewport (depending on which is available first) via the
31 C<value> argument to widget.
32
33 =head1 INCLUDED SUBCLASSES
34
35 =over
36
37 =item L<Reaction::UI::Widget::Value::Boolean>
38
39 Will simply display the C<value>.
40
41 =item L<Reaction::UI::Widget::Value::Collection>
42
43 This widget iterates over a collection of values provided by the viewport
44 and renders an unordered list out of them.
45
46 =item L<Reaction::UI::Widget::Value::DateTime>
47
48 A simple subclass of L<Reaction::UI::Widget::Value>, currently not doing
49 much.
50
51 =item L<Reaction::UI::Widget::Value::Image>
52
53 Provides C<has_image> and C<no_image> blocks that will be rendered depending
54 on the viewports C<value_string> attribute. The defaults are to either render
55 an image tag, or to output nothing at all.
56
57 =item L<Reaction::UI::Widget::Value::Number>
58
59 A simple subclass of C<Reaction::UI::Widget::Value> that doesn't do much yet.
60
61 =item L<Reaction::UI::Widget::Value::RelatedObject>
62
63 A simple subclass of C<Reaction::UI::Widget::Value> that doesn't do much yet.
64
65 =item L<Reaction::UI::Widget::Value::String>
66
67 A simple subclass of C<Reaction::UI::Widget::Value> that doesn't do much yet.
68
69 =item L<Reaction::UI::Widget::Value::Text>
70
71 A simple subclass of C<Reaction::UI::Widget::Value> that doesn't do much yet.
72
73 =back
74
75 =head1 FRAGMENTS
76
77 =head2 widget
78
79 Additional available arguments
80
81 =over 4
82
83 =item B<value> - The C<value_string> or C<value> of the viewport
84
85 =back
86
87 =head1 AUTHORS
88
89 See L<Reaction::Class> for authors.
90
91 =head1 LICENSE
92
93 See L<Reaction::Class> for the license.
94
95 =cut