X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FReaction%2FUI%2FWidget%2FField%2FMutable.pm;h=9fc565e2ede6c44983037a63b3f4a38b644c7bbd;hb=56d5a4eb0f9cef44c02759663616dd1f0893d483;hp=0e670e5ad915e76ef0033e5ecea01df1d7b22483;hpb=7d5da5c808020e1f6fcbf51b2dfc3fb34923345f;p=catagits%2FReaction.git diff --git a/lib/Reaction/UI/Widget/Field/Mutable.pm b/lib/Reaction/UI/Widget/Field/Mutable.pm index 0e670e5..9fc565e 100644 --- a/lib/Reaction/UI/Widget/Field/Mutable.pm +++ b/lib/Reaction/UI/Widget/Field/Mutable.pm @@ -22,7 +22,10 @@ extends 'Reaction::UI::Widget::Field'; }; implements fragment message_fragment { - if (my $message = $_{viewport}->message) { + my $vp = $_{viewport}; + return unless $vp->has_message; + my $message = $vp->message; + if ($message) { arg message => localized $message; render 'message'; } @@ -43,3 +46,191 @@ __PACKAGE__->meta->make_immutable; 1; __END__; + +=head1 NAME + +Reaction::UI::Widget::Field::Mutable - Mutable fields + +=head1 DESCRIPTION + +An extension of L representing fields +whose values can be mutated. + +=head1 FRAGMENTS + +=head2 widget + +The following additional arguments are provided: + +=over 4 + +=item field_id + +Contains the viewport's event id for C. + +=item field_name + +Defaults to the C argument unless already defined + +=item field_type + +Defaults to C. + +=item field_class + +A string containing the joined class attribute. Defaults to +C and the current viewport's C. + +=item exists_event + +Contains the event id for C. + +=item exists_value + +Defaults to C<1>. + +=back + +=head2 message_fragment + +Renders nothing if the viewport doesn't have a message. + +Otherwise, the C argument will be set to the localised string contained +in the viewport's C attribute and the C fragment will be rendered. + +=head2 field_is_required + +Will render either C or C depending on +if C on the viewport returns true and the viewports C +is empty. + +=head1 LAYOUT SETS + +=head2 base + + share/skin/base/layout/field/mutable.tt + +The following layouts are provided: + +=over 4 + +=item widget + +Builds a C element with a class attribute set to the C argument. +The element contents will be the C, C and C +fragments. + +=item label + +Builds a C