package Reaction::UI::Widget::Action; use Reaction::UI::WidgetClass; use namespace::clean -except => [ qw(meta) ]; extends 'Reaction::UI::Widget::Object::Mutable'; after fragment widget { my $vp = $_{viewport}; arg 'method' => $vp->method; arg 'form_id' => $vp->location; arg 'action' => $vp->has_action ? $vp->action : ''; }; implements fragment message { return unless $_{viewport}->has_message; arg message_string => $_{viewport}->message; render 'message_layout'; }; implements fragment error_message { return unless $_{viewport}->has_error_message; arg message_string => $_{viewport}->error_message; render 'error_message_layout'; }; implements fragment ok_button_fragment { if (grep { $_ eq 'ok' } $_{viewport}->accept_events) { arg 'event_id' => event_id 'ok'; arg 'label' => localized $_{viewport}->ok_label; render 'ok_button'; } }; implements fragment apply_button_fragment { if (grep { $_ eq 'apply' } $_{viewport}->accept_events) { arg 'event_id' => event_id 'apply'; arg 'label' => localized $_{viewport}->apply_label; render 'apply_button'; } }; implements fragment cancel_button_fragment { if (grep { $_ eq 'close' } $_{viewport}->accept_events) { arg 'event_id' => event_id 'close'; arg 'label' => localized $_{viewport}->close_label; render 'cancel_button'; } }; __PACKAGE__->meta->make_immutable; 1; __END__; =head1 NAME Reaction::UI::Widget::Action =head1 DESCRIPTION This is a subclass of L. =head1 FRAGMENTS =head2 widget Additionally provides the C argument containing the value of the viewport's C. =head2 message Empty if the viewport's C returns false. Otherwise sets the C argument to the viewport's C and renders the C fragment. =head2 error_message Same as the C fragment above except that it checks C, sets C to the viewport's C and renders C. =head2 ok_button_fragment Renders nothing unless the viewport accepts the C event. If it does, it provides the following arguments before rendering C: =over 4 =item event_id Is set to the event id C. =item label Is set to the localized C of the viewport. =back =head2 apply_button_fragment Renders nothing unless the viewport accepts the C event. If it does, it provides the following arguments before rendering C: =over 4 =item event_id Is set to the event id C. =item label Is set to the localized C of the viewport. =back =head2 cancel_button_fragment Renders nothing unless the viewport accepts the C event. If it does, it provides the following arguments before rendering C: =over 4 =item event_id Is set to the event id C. =item label Is set to the localized C of the viewport. =back =head1 LAYOUT SETS =head2 base share/skin/base/layout/action.tt The following layouts are provided: =over 4 =item widget Renders a C
element containing a C
. The C element contains the rendered C
, C, C and C