diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-10-11 20:34:25 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-10-11 20:34:25 +0000 |
commit | 6c3805b0b5072911989692f2e36c112476479327 (patch) | |
tree | 0bc0779f4163fc573391c9a8986f36f4761553c2 | |
parent | 206ce50371c1defcfd26fc979eaeb1090006c265 (diff) | |
download | reaction-6c3805b0b5072911989692f2e36c112476479327.tar.gz reaction-6c3805b0b5072911989692f2e36c112476479327.zip |
image vp, widget, template
-rw-r--r-- | lib/Reaction/UI/ViewPort/Image.pm | 15 | ||||
-rw-r--r-- | lib/Reaction/UI/Widget/Image.pm | 20 | ||||
-rw-r--r-- | share/skin/base/layout/image.tt | 5 |
3 files changed, 40 insertions, 0 deletions
diff --git a/lib/Reaction/UI/ViewPort/Image.pm b/lib/Reaction/UI/ViewPort/Image.pm new file mode 100644 index 0000000..a531e50 --- /dev/null +++ b/lib/Reaction/UI/ViewPort/Image.pm @@ -0,0 +1,15 @@ +package Reaction::UI::ViewPort::Image; + +use Reaction::Class; +use namespace::clean -except => [ qw(meta) ]; +extends 'Reaction::UI::ViewPort'; + +has uri => ( is => 'rw', isa => 'URI', required => 1); +has width => ( is => 'rw', isa => 'Int'); +has height => ( is => 'rw', isa => 'Int'); + +__PACKAGE__->meta->make_immutable; + +1; + +__END__; diff --git a/lib/Reaction/UI/Widget/Image.pm b/lib/Reaction/UI/Widget/Image.pm new file mode 100644 index 0000000..418c4e1 --- /dev/null +++ b/lib/Reaction/UI/Widget/Image.pm @@ -0,0 +1,20 @@ +package Reaction::UI::Widget::Image; + +use Reaction::UI::WidgetClass; +use namespace::clean -except => [ qw(meta) ]; + +before fragment widget { + my $vp = $_{viewport}; + my $attrs = { + uri => $vp->uri, + ($vp->has_width ? (width => $vp->width) : ()), + ($vp->has_height ? (height => $vp->height) : ()), + }; + arg img_attrs => attrs( $attrs ); +}; + +__PACKAGE__->meta->make_immutable; + +1; + +__END__; diff --git a/share/skin/base/layout/image.tt b/share/skin/base/layout/image.tt new file mode 100644 index 0000000..5030c8f --- /dev/null +++ b/share/skin/base/layout/image.tt @@ -0,0 +1,5 @@ +=for layout widget + +<img [% img_attrs %] /> + +=cut |