X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FReaction%2FUI%2FWidget%2FAction.pm;h=0994e6ec8cfaee352aebf7ed8131864ee579c3ff;hb=e653a48785a1942da650254c8fba30706ca18333;hp=2957317a1ed55e456104b376ef552fecb048d550;hpb=599c1172394e3377d8e3e28c06557a99a1a10d1e;p=catagits%2FReaction.git diff --git a/lib/Reaction/UI/Widget/Action.pm b/lib/Reaction/UI/Widget/Action.pm index 2957317..0994e6e 100644 --- a/lib/Reaction/UI/Widget/Action.pm +++ b/lib/Reaction/UI/Widget/Action.pm @@ -9,6 +9,18 @@ after fragment widget { arg 'method' => $_{viewport}->method; }; +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'; @@ -46,14 +58,172 @@ 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