| 1 | package Reaction::UI::Widget::Value::Image; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Reaction::UI::WidgetClass; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use namespace::clean -except => [ qw(meta) ]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | implements fragment image { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 9 | 0 | ▶ | if($_{viewport}->value_string) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | 0 | arg uri => $_{viewport}->uri; | |||||||||
| 11 | 0 | render 'has_image'; | |||||||||
| 12 | } else { | ||||||||||
| 13 | 0 | render 'no_image'; | |||||||||
| 14 | } | ||||||||||
| 15 | 1 | }; | |||||||||
| 16 | |||||||||||
| 17 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 18 | |||||||||||
| 19 | =head1 NAME | ||||||||||
| 20 | |||||||||||
| 21 | Reaction::UI::Widget::Value::Image - An image tag or non-image alternative | ||||||||||
| 22 | |||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||
| 24 | |||||||||||
| 25 | This widget allows you to render an image container that uses different | ||||||||||
| 26 | fragments for available and non-available images. | ||||||||||
| 27 | |||||||||||
| 28 | =head1 FRAGMENTS AND LAYOUTS | ||||||||||
| 29 | |||||||||||
| 30 | =head2 widget | ||||||||||
| 31 | |||||||||||
| 32 | Has only layout implementation. The widget fragment is inherited from | ||||||||||
| 33 | L<Reaction::UI::Widget>. The layout will simply render the | ||||||||||
| 34 | C<image> fragment. This fragment can be overwritten by your own layout to | ||||||||||
| 35 | render, for example, a frame around the image. | ||||||||||
| 36 | |||||||||||
| 37 | =head2 image | ||||||||||
| 38 | |||||||||||
| 39 | Is only implemented in the widget. If the viewport has a true value in | ||||||||||
| 40 | C<value_string>, the C<uri> argument will be set to the value of the C<uri> | ||||||||||
| 41 | attribute or method return value of the viewport, and the C<has_image> | ||||||||||
| 42 | fragment will be rendered. | ||||||||||
| 43 | |||||||||||
| 44 | If C<value_string> is false, the C<no_image> fragment will be rendered. | ||||||||||
| 45 | |||||||||||
| 46 | =head2 has_image | ||||||||||
| 47 | |||||||||||
| 48 | This is only implemented in the layout file. It contains just an image | ||||||||||
| 49 | tag and will be rendered when the viewport has a true C<value_string>. | ||||||||||
| 50 | |||||||||||
| 51 | =head2 no_image | ||||||||||
| 52 | |||||||||||
| 53 | This has only an empty implementation in the layout file. It will output | ||||||||||
| 54 | nothing and is called when then viewport has a false C<value_string>. | ||||||||||
| 55 | |||||||||||
| 56 | =head1 LAYOUT TEMPLATE | ||||||||||
| 57 | |||||||||||
| 58 | share/skin/base/layout/value/image.tt | ||||||||||
| 59 | |||||||||||
| 60 | =head1 AUTHORS | ||||||||||
| 61 | |||||||||||
| 62 | See L<Reaction::Class> for authors. | ||||||||||
| 63 | |||||||||||
| 64 | =head1 LICENSE | ||||||||||
| 65 | |||||||||||
| 66 | See L<Reaction::Class> for the license. | ||||||||||
| 67 | |||||||||||
| 68 | =cut | ||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | 1 | 1; | |||||||||