From 6c3805b0b5072911989692f2e36c112476479327 Mon Sep 17 00:00:00 2001 From: groditi Date: Sat, 11 Oct 2008 20:34:25 +0000 Subject: image vp, widget, template --- lib/Reaction/UI/ViewPort/Image.pm | 15 +++++++++++++++ lib/Reaction/UI/Widget/Image.pm | 20 ++++++++++++++++++++ share/skin/base/layout/image.tt | 5 +++++ 3 files changed, 40 insertions(+) create mode 100644 lib/Reaction/UI/ViewPort/Image.pm create mode 100644 lib/Reaction/UI/Widget/Image.pm create mode 100644 share/skin/base/layout/image.tt 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 + + + +=cut -- cgit v1.2.3-54-g00ecf