Reaction::UI::Widget::Data - Abstract class to render a data hash reference


Reaction documentation Contained in the Reaction distribution.

Index


Code Index:

NAME

Top

Reaction::UI::Widget::Data - Abstract class to render a data hash reference

DESCRIPTION

Top

This takes the args method return value of the viewport and populates the arguments with names and values from that value.

FRAGMENTS

Top

widget

Sets an argument for every key and value in the viewport's args method return value (which is expected to be a hash reference).

EXAMPLE LAYOUT

Top

Assuming this hash reference:

  { first_name => "Foo", last_name => "Bar" }

we can access it in a layout set like this:

  =widget Data

  =for layout widget

  Hello [% last_name | html %], [% first_name | html %]!

  =cut

AUTHORS

Top

See Reaction::Class for authors.

LICENSE

Top

See Reaction::Class for the license.


Reaction documentation Contained in the Reaction distribution.

package Reaction::UI::Widget::Data;

use Reaction::UI::WidgetClass;
use namespace::clean -except => [qw(meta)];

extends 'Reaction::UI::Widget::Container';

before fragment widget {
  my $data = $_{viewport}->args;
  arg $_ => $data->{$_} for keys %$data;
};

1;

__END__