widget documentation
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field / Image.pm
1 package Reaction::UI::Widget::Field::Image;
2
3 use Reaction::UI::WidgetClass;
4
5 use namespace::clean -except => [ qw(meta) ];
6 extends 'Reaction::UI::Widget::Field';
7
8
9  
10 implements fragment image {
11   if($_{viewport}->value_string) {
12     arg uri => $_{viewport}->uri;
13     render 'has_image';
14   } else {
15     render 'no_image';
16   }
17 };
18
19 __PACKAGE__->meta->make_immutable;
20
21 1;
22
23 __END__
24
25 =head1 NAME
26
27 Reaction::UI::Widget::Field::Image - An image field
28
29 =head1 DESCRIPTION
30
31 This L<Reaction::UI::Widget::Field> widget represents an image.
32
33 =head1 FRAGMENTS
34
35 =head2 image
36
37 If the viewport's C<value_string> is true, it will render the C<has_image>
38 fragment after setting the C<uri> argument to the value of the viewport's
39 C<uri>.
40
41 If the C<value_string> is false the C<no_image> fragment will be rendered.
42
43 =head1 SEE ALSO
44
45 =over 4
46
47 =item * L<Reaction::UI::Widget::Field>
48
49 =item * L<Reaction::UI::Widget::Value::Image>
50
51 =back
52
53 =head1 AUTHORS
54
55 See L<Reaction::Class> for authors.
56
57 =head1 LICENSE
58
59 See L<Reaction::Class> for the license.
60
61 =cut