diff options
author | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-08-08 00:21:01 +0000 |
---|---|---|
committer | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-08-08 00:21:01 +0000 |
commit | a86de581e80ee37e60860bde8ddaa975ff7dd6c9 (patch) | |
tree | a0e3244407c8760a8527ed5025c980f663525f3d /lib/Reaction/UI/WidgetClass.pm | |
parent | c0d494fbf4de3a6a9e14e120518cb52d8591577b (diff) | |
download | reaction-a86de581e80ee37e60860bde8ddaa975ff7dd6c9.tar.gz reaction-a86de581e80ee37e60860bde8ddaa975ff7dd6c9.zip |
sketch of 'attrs' widget helper
Diffstat (limited to 'lib/Reaction/UI/WidgetClass.pm')
-rw-r--r-- | lib/Reaction/UI/WidgetClass.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Reaction/UI/WidgetClass.pm b/lib/Reaction/UI/WidgetClass.pm index 7e7216c..22e00e6 100644 --- a/lib/Reaction/UI/WidgetClass.pm +++ b/lib/Reaction/UI/WidgetClass.pm @@ -78,6 +78,19 @@ override exports_for_package => sub { my %args = map{ $vp->event_id_for($_) => $events->{$_} } keys %$events; $vp->ctx->req->uri_with(\%args); }, + attrs => sub { + my ($attrs) = @_; + return join(' ', map { + my $text = $attrs->{$_}; + for ($text) { + s/&/&/g; + s/</</g; + s/>/>/g; + s/"/"/g; + } + qq{$_="${text}"}; + } keys %$attrs); + }, ); }; override default_base => sub { ('Reaction::UI::Widget') }; |