search spec components factored out of T365
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Image.pm
CommitLineData
6c3805b0 1package Reaction::UI::Widget::Image;
2
3use Reaction::UI::WidgetClass;
4use namespace::clean -except => [ qw(meta) ];
5
6before fragment widget {
7 my $vp = $_{viewport};
8 my $attrs = {
2aa8d0f2 9 src => $vp->uri,
6c3805b0 10 ($vp->has_width ? (width => $vp->width) : ()),
11 ($vp->has_height ? (height => $vp->height) : ()),
12 };
13 arg img_attrs => attrs( $attrs );
14};
15
16__PACKAGE__->meta->make_immutable;
17
181;
19
20__END__;
f9b32c83 21
22=head1 NAME
23
24Reaction::UI::Widget::Image - An image with optional height and width properties
25
26=head1 DESCRIPTION
27
28=head1 FRAGMENTS
29
30=head2 widget
31
32The widget layout will be provided with an additional C<img_attrs> argument containing
33a rendered string of the image's attributes containing:
34
35=over 4
36
37=item src
38
39The return value of the viewports C<uri> method.
40
41=item width
42
43The value of the viewports C<width> attribute if one was found.
44
45=item height
46
47The value of the viewports C<height> attribute if one was found.
48
49=back
50
51=head1 LAYOUT SETS
52
53 share/skin/base/layout/image.tt
54
55=head1 AUTHORS
56
57See L<Reaction::Class> for authors.
58
59=head1 LICENSE
60
61See L<Reaction::Class> for the license.
62
63=cut