diff options
46 files changed, 920 insertions, 328 deletions
diff --git a/lib/Reaction/UI/View.pm b/lib/Reaction/UI/View.pm index 5c26113..4778c25 100644 --- a/lib/Reaction/UI/View.pm +++ b/lib/Reaction/UI/View.pm @@ -57,7 +57,7 @@ class View which { implements 'widget_class_for' => as { my ($self, $layout_set) = @_; - my $base = ref($self); + my $base = $self->blessed; my $tail = $layout_set->widget_type; my $class = join('::', $base, 'Widget', $tail); Class::MOP::load_class($class); diff --git a/lib/Reaction/UI/Widget/ActionForm.pm b/lib/Reaction/UI/Widget/ActionForm.pm index 484453c..a631130 100644 --- a/lib/Reaction/UI/Widget/ActionForm.pm +++ b/lib/Reaction/UI/Widget/ActionForm.pm @@ -6,7 +6,7 @@ class ActionForm, which { widget renders [qw/header fields buttons footer/ => { viewport => func('self','viewport') } ]; - fields renders [viewport over func('self','ordered_fields')]; + fields renders [viewport over func('viewport','ordered_fields')]; buttons renders [ string {"DUMMY"} ], {message => func('viewport','message'); header renders [ string {"DUMMY"} ]; @@ -18,45 +18,44 @@ class ActionForm, which { __END__; -=for layout widget - <form action="" method="post" enctype="multipart/form-data"> - [% header %] - [% fields %] - [% buttons %] - [% footer %] - </form> +=head1 NAME -=for layout header +Reaction::UI::Widget::ActionForm -<h2>Le Header</h2> +=head1 DESCRIPTION -=for layout fields +=head1 FRAGMENTS -[% content %] <br /> +=head2 widget -=for layout buttons +Additional variables available in topic hash: "viewport". - [% IF message; %] - <span>[% message %]</span> <br /> - [% END; %] +Renders "header", "fields", "buttons" and "footer" - [% allowed_events = viewport.accept_events; %] - [% IF allowed_events.grep('^ok$').size; %] - <input type="submit" name="[% viewport.event_id_for('ok') | html%]" value="ok" /> - [% END; %] +=head2 fields - [% IF (viewport.ordered_fields.size != 0) && allowed_events.grep('^apply$').size; %] - <input type="submit" name="[% viewport.event_id_for('apply') | html%]" value="apply" /> - [% END; %] +Sequentially renders the C<ordered_fields> of the viewport - [% IF allowed_events.grep('^close$').size; %] - <input type="submit" name="[% viewport.event_id_for('close') | html%]" value="cancel" /> - [% END; %] - <br /> +=head2 buttons -=for layout footer +Additional variables available in topic hash: "message" - <h2>Le Footer</h2> +=head2 header + +Content is a dummy value + +=head2 footer + +Content is a dummy value + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut + diff --git a/lib/Reaction/UI/Widget/DisplayField.pm b/lib/Reaction/UI/Widget/DisplayField.pm new file mode 100644 index 0000000..c454188 --- /dev/null +++ b/lib/Reaction/UI/Widget/DisplayField.pm @@ -0,0 +1,43 @@ +package Reaction::UI::Widget::DisplayField; + +use Reaction::UI::WidgetClass; + +class Text, which { + widget renders [ qw/label value/ => { viewport => func(self => 'viewport') } ]; + label renders [ string { $_{viewport}->label } ]; + value renders [ string { $_{viewport}->value } ]; +}; + +1; + +=head1 NAME + +Reaction::UI::Widget::DisplayField + +=head1 DESCRIPTION + +=head1 FRAGMENTS + +=head2 widget + +Additional variables available in topic hash: "viewport". + +Renders "label" and "field" + +=head2 field + + C<content> will contain the value, if any, of the field. + +=head2 label + + C<content> will contain the label, if any, of the field. + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. + +=cut diff --git a/lib/Reaction/UI/Widget/DisplayField/Boolean.pm b/lib/Reaction/UI/Widget/DisplayField/Boolean.pm index e1d9e9a..93dfc59 100644 --- a/lib/Reaction/UI/Widget/DisplayField/Boolean.pm +++ b/lib/Reaction/UI/Widget/DisplayField/Boolean.pm @@ -2,9 +2,7 @@ package Reaction::UI::Widget::DisplayField::Boolean; use Reaction::UI::WidgetClass; -class Boolean, which { - widget renders [ qw/label value/ => { viewport => func(self => 'viewport') } ]; - label renders [ string { $_{viewport}->label } ]; +class Boolean is 'Reaction::UI::Widget::DisplayField', which { value renders [ string { $_{viewport}->value_string } ]; }; @@ -12,17 +10,26 @@ class Boolean, which { __END__; -=for layout widget +=head1 NAME -[% content %] +Reaction::UI::Widget::DisplayField::Boolean -=for layout label +=head1 DESCRIPTION -<strong > [ % content %]: </strong> +See L<Reaction::UI::Widget::DisplayField> -=for layout value +=head1 FRAGMENTS -[% content %] +=head2 value -=cut +C<content> contains the viewport's value_string + +=head1 AUTHORS + +See L<Reaction::Class> for authors. +=head1 LICENSE + +See L<Reaction::Class> for the license. + +=cut diff --git a/lib/Reaction/UI/Widget/DisplayField/Collection.pm b/lib/Reaction/UI/Widget/DisplayField/Collection.pm index 4e65331..a64c657 100644 --- a/lib/Reaction/UI/Widget/DisplayField/Collection.pm +++ b/lib/Reaction/UI/Widget/DisplayField/Collection.pm @@ -3,33 +3,47 @@ package Reaction::UI::Widget::DisplayField::Collection; use Reaction::UI::WidgetClass; class Collection, which { - widget renders [ qw/label list item/ => { viewport => func(self => 'viewport') } ]; + widget renders [ qw/label list/ => { viewport => func(self => 'viewport') } ]; label renders [ string { $_{viewport}->label } ]; list renders [ item over func('viewport', 'value_names') ]; - item renders [ string { $_{_} } ]; + item renders [ string { $_ } ]; }; 1; __END__; -=for layout widget -[% label %] -[% list %] +=head1 NAME -=for layout label +Reaction::UI::Widget::DisplayField::Collection -<strong > [ % content %]: </strong> +=head1 DESCRIPTION -=for layout list +=head1 FRAGMENTS -<ul> -[% item %] -</ul> +=head2 widget -=for layout item +renders C<label> and C<list> passing additional variable "viewport" -<li>[% content %]</li> +=head2 label + +C<content> contains the viewport's label + +=head2 list + +renders fragment item over the viewport's C<value_names> + +=head2 item + +C<content> contains the value of the current item ($_ / $_{_}) + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/DisplayField/DateTime.pm b/lib/Reaction/UI/Widget/DisplayField/DateTime.pm index d6d0446..e403a9a 100644 --- a/lib/Reaction/UI/Widget/DisplayField/DateTime.pm +++ b/lib/Reaction/UI/Widget/DisplayField/DateTime.pm @@ -2,26 +2,34 @@ package Reaction::UI::Widget::DisplayField::DateTime; use Reaction::UI::WidgetClass; -class DateTime, which { - widget renders [ qw/label value/ => { viewport => func(self => 'viewport') } ]; - label renders [ string { $_{viewport}->label } ]; - value renders [ string { $_{viewport}->value_string } ]; +class DateTime is 'Reaction::UI::Widget::DisplayField', which { + value renders [ string { $_{viewport}->value_string } ]; }; 1; __END__; -=for layout widget +=head1 NAME -[% content %] +Reaction::UI::Widget::DisplayField::DateTime -=for layout label +=head1 DESCRIPTION -<strong > [ % content %]: </strong> +See L<Reaction::UI::Widget::DisplayField> -=for layout value +=head1 FRAGMENTS -[% content %] +=head2 value + +C<content> contains the viewport's value_string + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/DisplayField/List.pm b/lib/Reaction/UI/Widget/DisplayField/List.pm index 06e7cb4..3b3d779 100644 --- a/lib/Reaction/UI/Widget/DisplayField/List.pm +++ b/lib/Reaction/UI/Widget/DisplayField/List.pm @@ -13,23 +13,36 @@ class List, which { __END__; -=for layout widget +=head1 NAME -[% label %] -[% list %] +Reaction::UI::Widget::DisplayField::List -=for layout label +=head1 DESCRIPTION -<strong > [ % content %]: </strong> +=head1 FRAGMENTS -=for layout list +=head2 widget -<ul> -[% item %] -</ul> +renders C<label> and C<list> passing additional variable "viewport" -=for layout item +=head2 label -<li>[% content %]</li> +C<content> contains the viewport's label + +=head2 list + +renders fragment item over the viewport's C<value_names> + +=head2 item + +C<content> contains the value of the current item ($_ / $_{_}) + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/DisplayField/Number.pm b/lib/Reaction/UI/Widget/DisplayField/Number.pm index 7f9d928..9260c2e 100644 --- a/lib/Reaction/UI/Widget/DisplayField/Number.pm +++ b/lib/Reaction/UI/Widget/DisplayField/Number.pm @@ -2,26 +2,28 @@ package Reaction::UI::Widget::DisplayField::Number; use Reaction::UI::WidgetClass; -class Number, which { - widget renders [ qw/label value/ => { viewport => func(self => 'viewport') } ]; - label renders [ string { $_{viewport}->label } ]; - value renders [ string { $_{viewport}->value } ]; +class Number is 'Reaction::UI::Widget::DisplayField', which { + }; 1; __END__; -=for layout widget +=head1 NAME + +Reaction::UI::Widget::DisplayField::Numberx + +=head1 DESCRIPTION -[% content %] +See L<Reaction::UI::Widget::DisplayField> -=for layout label +=head1 AUTHORS -<strong > [ % content %]: </strong> +See L<Reaction::Class> for authors. -=for layout value +=head1 LICENSE -[% content %] +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/DisplayField/RelatedObject.pm b/lib/Reaction/UI/Widget/DisplayField/RelatedObject.pm index 58f1b78..fa415e7 100644 --- a/lib/Reaction/UI/Widget/DisplayField/RelatedObject.pm +++ b/lib/Reaction/UI/Widget/DisplayField/RelatedObject.pm @@ -2,9 +2,7 @@ package Reaction::UI::Widget::DisplayField::RelatedObject; use Reaction::UI::WidgetClass; -class RelatedObject, which { - widget renders [ qw/label value/ => { viewport => func(self => 'viewport') } ]; - label renders [ string { $_{viewport}->label } ]; +class RelatedObject is 'Reaction::UI::Widget::DisplayField', which { value renders [ string { $_{viewport}->value_string } ]; }; @@ -12,16 +10,26 @@ class RelatedObject, which { __END__; -=for layout widget +=head1 NAME -[% content %] +Reaction::UI::Widget::DisplayField::RelatedObject -=for layout label +=head1 DESCRIPTION -<strong > [ % content %]: </strong> +See L<Reaction::UI::Widget::DisplayField> -=for layout value +=head1 FRAGMENTS -[% content %] +=head2 value + +C<content> contains the viewport's value_string + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/DisplayField/String.pm b/lib/Reaction/UI/Widget/DisplayField/String.pm index 9530996..0301a15 100644 --- a/lib/Reaction/UI/Widget/DisplayField/String.pm +++ b/lib/Reaction/UI/Widget/DisplayField/String.pm @@ -2,26 +2,28 @@ package Reaction::UI::Widget::DisplayField::String; use Reaction::UI::WidgetClass; -class String, which { - widget renders [ qw/label value/ => { viewport => func(self => 'viewport') } ]; - label renders [ string { $_{viewport}->label } ]; - value renders [ string { $_{viewport}->value } ]; +class String is 'Reaction::UI::Widget::DisplayField', which { + }; 1; __END__; -=for layout widget +=head1 NAME + +Reaction::UI::Widget::DisplayField::String + +=head1 DESCRIPTION -[% content %] +See L<Reaction::UI::Widget::DisplayField> -=for layout label +=head1 AUTHORS -<strong > [ % content %]: </strong> +See L<Reaction::Class> for authors. -=for layout value +=head1 LICENSE -[% content %] +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/DisplayField/Text.pm b/lib/Reaction/UI/Widget/DisplayField/Text.pm index fd9c111..d7c4c2e 100644 --- a/lib/Reaction/UI/Widget/DisplayField/Text.pm +++ b/lib/Reaction/UI/Widget/DisplayField/Text.pm @@ -2,26 +2,28 @@ package Reaction::UI::Widget::DisplayField::Text; use Reaction::UI::WidgetClass; -class Text, which { - widget renders [ qw/label value/ => { viewport => func(self => 'viewport') } ]; - label renders [ string { $_{viewport}->label } ]; - value renders [ string { $_{viewport}->value } ]; +class Text is 'Reaction::UI::Widget::DisplayField', which { + }; 1; __END__; -=for layout widget +=head1 NAME + +Reaction::UI::Widget::DisplayField::Text + +=head1 DESCRIPTION -[% content %] +See L<Reaction::UI::Widget::DisplayField> -=for layout label +=head1 AUTHORS -<strong > [ % content %]: </strong> +See L<Reaction::Class> for authors. -=for layout value +=head1 LICENSE -[% content %] +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field.pm b/lib/Reaction/UI/Widget/Field.pm index f3caf3b..6425f15 100644 --- a/lib/Reaction/UI/Widget/Field.pm +++ b/lib/Reaction/UI/Widget/Field.pm @@ -25,3 +25,58 @@ class Field, which { 1; +=head1 NAME + +Reaction::UI::Widget::Field + +=head1 DESCRIPTION + +=head1 ATTRIBUTES + +=head2 id + +Str, lazy builds. + +=head2 name + +Str, lazy builds. + +=head1 METHODS + +=head2 build_id + +Returns the viewport's C<event_id_for('value')> + +=head2 build_name + +Returns the viewport's C<event_id_for('value')> + +=head1 FRAGMENTS + +=head2 widget + +Additional variables available in topic hash: "viewport", "id", "name". + +Renders "label","field" and "message" + +=head2 field + + C<content> will contain the value, if any, of the field. + +=head2 label + + C<content> will contain the label, if any, of the field. + +=head2 message + + C<content> will contain the message, if any, of the field. + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. + +=cut diff --git a/lib/Reaction/UI/Widget/Field/Boolean.pm b/lib/Reaction/UI/Widget/Field/Boolean.pm index c6afaff..536764c 100644 --- a/lib/Reaction/UI/Widget/Field/Boolean.pm +++ b/lib/Reaction/UI/Widget/Field/Boolean.pm @@ -8,35 +8,20 @@ class Boolean is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget +=head1 NAME -[% label %] [% field %] [% message %] <br> +Reaction::UI::Widget::Field::Boolean -=for layout field +=head1 DESCRIPTION -[% - IF content; - checked = 'checked="checked"'; - ELSE; - checked = ""; - END; -%] +See L<Reaction::UI::Widget::Field> -<!-- We need a replacement for process_attrs --> -<input type="checkbox" id="[% id | html %]" name="[% name | html %]" value="1" [% checked %] /> +=head1 AUTHORS -=for layout label +See L<Reaction::Class> for authors. -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id %]"> [% content | html %]: </label> -[% END %] +=head1 LICENSE -=for layout message - -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/ChooseMany.pm b/lib/Reaction/UI/Widget/Field/ChooseMany.pm index 6d10b3f..bd11672 100644 --- a/lib/Reaction/UI/Widget/Field/ChooseMany.pm +++ b/lib/Reaction/UI/Widget/Field/ChooseMany.pm @@ -18,69 +18,48 @@ class ChooseMany is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget +=head1 NAME -[% label %] -<br /> -[% message %] -[% field %] +Reaction::UI::Widget::Field::ChooseMany -=for layout field +=head1 DESCRIPTION -<table> - <tr> - <td> [% available_values %] </td> - <td> [% action_buttons %] </td> - <td> - [% selected_values %] - [% current_values %] - </td> - </tr> -</table> +See L<Reaction::UI::Widget::Field> -=for layout available_values +This needs a refactor to not be tied to a dual select box, but ENOTIME -<select size="10" multiple="multiple" name="[% viewport.event_id_for('add_values') | html %]"> - [% content %] -</select> +=head1 FRAGMENTS -=for layout selected_values +=head2 field -<select size="10" multiple="multiple" name="[% viewport.event_id_for('remove_values') | html %]"> - [% content %] -</select> +renders C<available_values>, C<action_buttons>, C<selected_values> and C<current_values> -=for layout current_values +=head2 current values -[% content %] +renders the viewport's current_value_choices over hidden_value -=for layout hidden_value +=head2 hidden_value -<input type="hidden" name="[% viewport.event_id_for('value') | html %]" value="[% content | html %]"> +C<content> is the value of the current choice -=for layout option +=head2 available_value -<option value="[% v_value | html %]">[% v_name | html %]</option> +rendersthe viewport's current_available_value_choices over the option fragment -=for layout action_buttons +=head2 selected_value -<input type="submit" value=">>" name="[% viewport.event_id_for('add_all_values') | html %]" /> -<input type="submit" value=">" name="[% viewport.event_id_for('do_add_values') | html %]" /> <br /> -<input type="submit" value="<" name="[% viewport.event_id_for('do_remove_values') | html %]" /> <br /> -<input type="submit" value="<<" name="[% viewport.event_id_for('remove_all_values') | html %]" /> <br /> +rendersthe viewport's current_selected_value_choices over the option fragment -=for layout label +=head2 option -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label> [% content | html %]: </label> -[% END %] +C<content> is a dummy value but C<v_value> and C<v_name> are both set. -=for layout message +=head1 AUTHORS -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> <br /> -[% END %] +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/ChooseOne.pm b/lib/Reaction/UI/Widget/Field/ChooseOne.pm index 3422261..7ac1898 100644 --- a/lib/Reaction/UI/Widget/Field/ChooseOne.pm +++ b/lib/Reaction/UI/Widget/Field/ChooseOne.pm @@ -18,43 +18,34 @@ class ChooseOne is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget -[% label %] [% field %] [% message %] +=head1 NAME -=for layout field +Reaction::UI::Widget::Field::ChooseOne -<!-- We need a replacement for process_attrs --> -<select name="[% name | html %]" id="[% id | html %]"> - [% IF is_required %] - <option value="">--</option> - [% END %] - [% content %] -</select> +=head1 DESCRIPTION -=for layout option +See L<Reaction::UI::Widget::Field> - [% IF is_selected; - selected = ' selected="selected"'; - ELSE; - selected = ''; - END; - %] - <!-- I should convert this stuff to process_attrs to keep it cleaner --> - <option value="[% v_value | html%]" [% selected %]> [% v_name | html %]</option> +=head1 FRAGMENTS -=for layout label +=head2 field -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +Renders a series fragment C<option> for each C<value_choices> in the viewport -=for layout message +Additional varibles set: C<is_required> - Boolean, self-explanatory -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +=head2 option + +C<content> is a dummy variable, but th additional variables C<v_value>, C<v_name> +and C<is_selected> are set + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/DateTime.pm b/lib/Reaction/UI/Widget/Field/DateTime.pm index f328cd7..9181387 100644 --- a/lib/Reaction/UI/Widget/Field/DateTime.pm +++ b/lib/Reaction/UI/Widget/Field/DateTime.pm @@ -10,27 +10,27 @@ class DateTime is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget -[% label %] [% field %] [% message %] +=head1 NAME -=for layout field +Reaction::UI::Widget::Field::DateTime -<!-- We need a replacement for process_attrs --> -<input type="text" name="[% name | html %]" id="[% id | html%]" value="[% content | html %]" /> +=head1 DESCRIPTION -=for layout label +See L<Reaction::UI::Widget::Field> -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +=head1 FRAGMENTS -=for layout message +=head2 field -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +C<content> contains viewport's C<value_string> + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/File.pm b/lib/Reaction/UI/Widget/Field/File.pm index b0c11cc..aa079c7 100644 --- a/lib/Reaction/UI/Widget/Field/File.pm +++ b/lib/Reaction/UI/Widget/Field/File.pm @@ -9,26 +9,20 @@ class File is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget +=head1 NAME -[% label %] [% field %] [% message %] +Reaction::UI::Widget::Field::File -=for layout field +=head1 DESCRIPTION -<input type="file" name="[% name | html%]" id="[% id | html %]" /> +See L<Reaction::UI::Widget::Field> -=for layout label +=head1 AUTHORS -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +See L<Reaction::Class> for authors. -=for layout message +=head1 LICENSE -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/HiddenArray.pm b/lib/Reaction/UI/Widget/Field/HiddenArray.pm index 010e458..05cdd45 100644 --- a/lib/Reaction/UI/Widget/Field/HiddenArray.pm +++ b/lib/Reaction/UI/Widget/Field/HiddenArray.pm @@ -12,20 +12,30 @@ class HiddenArray is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget +=head1 NAME -[% field %] +Reaction::UI::Widget::Field::HiddenArray -=for layout field +=head1 DESCRIPTION -[% item %] +See L<Reaction::UI::Widget::Field> -=for layout item +=head1 FRAGMENTS -<input type="hidden" name="[% name | html %]" value="[% content | html %]" /> +=head2 field -=for layout label +renders fragment C<item> over the values of 'value' arrayref -=for layout message +=head2 item + +C<content> is $_{_} / $_ (current item in the 'value' array) + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/Number.pm b/lib/Reaction/UI/Widget/Field/Number.pm index 2cd371f..859e7c2 100644 --- a/lib/Reaction/UI/Widget/Field/Number.pm +++ b/lib/Reaction/UI/Widget/Field/Number.pm @@ -8,27 +8,21 @@ class Number is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget -[% label %] [% field %] [% message %] +=head1 NAME -=for layout field +Reaction::UI::Widget::Field::Number -<!-- We need a replacement for process_attrs --> -<input type="text" name="[% name | html%]" id="[% id | html %]" value="[% content | html %]" /> +=head1 DESCRIPTION -=for layout label +See L<Reaction::UI::Widget::Field> -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +=head1 AUTHORS -=for layout message +See L<Reaction::Class> for authors. -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/Password.pm b/lib/Reaction/UI/Widget/Field/Password.pm index 1b794e0..3b53b54 100644 --- a/lib/Reaction/UI/Widget/Field/Password.pm +++ b/lib/Reaction/UI/Widget/Field/Password.pm @@ -8,27 +8,21 @@ class Password is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget -[% label %] [% field %] [% message %] +=head1 NAME -=for layout field +Reaction::UI::Widget::Field::Password -<!-- We need a replacement for process_attrs --> -<input type="password" name="[% name | html %]" id="[% id | html %]" value="[% content | html %]" /> +=head1 DESCRIPTION -=for layout label +See L<Reaction::UI::Widget::Field> -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +=head1 AUTHORS -=for layout message +See L<Reaction::Class> for authors. -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/String.pm b/lib/Reaction/UI/Widget/Field/String.pm index f2380dd..eb25c8f 100644 --- a/lib/Reaction/UI/Widget/Field/String.pm +++ b/lib/Reaction/UI/Widget/Field/String.pm @@ -8,27 +8,20 @@ class String is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget +=head1 NAME -[% label %] [% field %] [% message %] +Reaction::UI::Widget::Field::String -=for layout field +=head1 DESCRIPTION -<!-- We need a replacement for process_attrs --> -<input type="text" name="[% name | html %]" id="[% id | html %]" value="[% content | html %]" /> +See L<Reaction::UI::Widget::Field> -=for layout label +=head1 AUTHORS -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +See L<Reaction::Class> for authors. -=for layout message +=head1 LICENSE -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/Text.pm b/lib/Reaction/UI/Widget/Field/Text.pm index 9bc152c..1066633 100644 --- a/lib/Reaction/UI/Widget/Field/Text.pm +++ b/lib/Reaction/UI/Widget/Field/Text.pm @@ -8,29 +8,21 @@ class Text is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget -[% label %] [% field %] [% message %] +=head1 NAME -=for layout field +Reaction::UI::Widget::Field::Text -<!-- We need a replacement for process_attrs --> -<textarea name="[% name | html %]" id="[% id | html %]"> - [% content | html %] -</textarea> +=head1 DESCRIPTION -=for layout label +See L<Reaction::UI::Widget::Field> -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +=head1 AUTHORS -=for layout message +See L<Reaction::Class> for authors. -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/Field/TimeRange.pm b/lib/Reaction/UI/Widget/Field/TimeRange.pm index a23e951..f96a2c8 100644 --- a/lib/Reaction/UI/Widget/Field/TimeRange.pm +++ b/lib/Reaction/UI/Widget/Field/TimeRange.pm @@ -9,26 +9,22 @@ class TimeRange is 'Reaction::UI::Widget::Field', which { 1; -=for layout widget +=head1 NAME -[% label %] [% field %] [% message %] +Reaction::UI::Widget::Field::TimeRange -=for layout field +=head1 DESCRIPTION -TODO +Warning: INCOMPLETE CLASS -=for layout label +See L<Reaction::UI::Widget::Field> -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <label for="[% id | html %]"> [% content | html %]: </label> -[% END %] +=head1 AUTHORS -=for layout message +See L<Reaction::Class> for authors. -<!-- This conditional goes away when mst comes up with something better --> -[% IF content %] - <span> [% content | html %] </span> -[% END %] +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/lib/Reaction/UI/Widget/ObjectView.pm b/lib/Reaction/UI/Widget/ObjectView.pm index 8b8a941..28614b6 100644 --- a/lib/Reaction/UI/Widget/ObjectView.pm +++ b/lib/Reaction/UI/Widget/ObjectView.pm @@ -4,19 +4,38 @@ use Reaction::UI::WidgetClass; class ObjectView, which { widget renders [ fields => { viewport => func('self', 'viewport') } ]; - field renders [ viewport over func('viewport','ordered_fields') } ]; + fields renders [ viewport over func('viewport','ordered_fields') } ]; }; 1; __END__; -=for layout widget - [% field %] +=head1 NAME -=for layout field +Reaction::UI::Widget::ObjectView - [% content %]<br> +=head1 DESCRIPTION + +=head1 FRAGMENTS + +=head2 widget + +Additional variables available in topic hash: "viewport". + +Renders "fields" + +=head2 fields + +Sequentially renders the C<ordered_fields> of the viewport + +=head1 AUTHORS + +See L<Reaction::Class> for authors. + +=head1 LICENSE + +See L<Reaction::Class> for the license. =cut diff --git a/share/skin/default/layout/action_form b/share/skin/default/layout/action_form new file mode 100644 index 0000000..fbbeb17 --- /dev/null +++ b/share/skin/default/layout/action_form @@ -0,0 +1,42 @@ +=for layout widget + + <form action="" method="post" enctype="multipart/form-data"> + [% header %] + [% fields %] + [% buttons %] + [% footer %] + </form> + +=for layout header + +<h2>Le Header</h2> + +=for layout fields + +[% content %] <br /> + +=for layout buttons + + [% IF message; %] + <span>[% message %]</span> <br /> + [% END; %] + + [% allowed_events = viewport.accept_events; %] + [% IF allowed_events.grep('^ok$').size; %] + <input type="submit" name="[% viewport.event_id_for('ok') | html%]" value="ok" /> + [% END; %] + + [% IF (viewport.ordered_fields.size != 0) && allowed_events.grep('^apply$').size; %] + <input type="submit" name="[% viewport.event_id_for('apply') | html%]" value="apply" /> + [% END; %] + + [% IF allowed_events.grep('^close$').size; %] + <input type="submit" name="[% viewport.event_id_for('close') | html%]" value="cancel" /> + [% END; %] + <br /> + +=for layout footer + + <h2>Le Footer</h2> + +=cut diff --git a/share/skin/default/layout/display_field/boolean b/share/skin/default/layout/display_field/boolean new file mode 100644 index 0000000..dae2f22 --- /dev/null +++ b/share/skin/default/layout/display_field/boolean @@ -0,0 +1,13 @@ +=for layout widget + +[% content %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout value + +[% content %] + +=cut
\ No newline at end of file diff --git a/share/skin/default/layout/display_field/collection b/share/skin/default/layout/display_field/collection new file mode 100644 index 0000000..bea7fa5 --- /dev/null +++ b/share/skin/default/layout/display_field/collection @@ -0,0 +1,20 @@ +=for layout widget + +[% label %] +[% list %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout list + +<ul> +[% item %] +</ul> + +=for layout item + +<li>[% content %]</li> + +=cut diff --git a/share/skin/default/layout/display_field/date_time b/share/skin/default/layout/display_field/date_time new file mode 100644 index 0000000..e531148 --- /dev/null +++ b/share/skin/default/layout/display_field/date_time @@ -0,0 +1,13 @@ +=for layout widget + +[% content %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout value + +[% content %] + +=cut diff --git a/share/skin/default/layout/display_field/list b/share/skin/default/layout/display_field/list new file mode 100644 index 0000000..e000875 --- /dev/null +++ b/share/skin/default/layout/display_field/list @@ -0,0 +1,20 @@ +=for layout widget + +[% label %] +[% list %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout list + +<ul> +[% item %] +</ul> + +=for layout item + +<li>[% content %]</li> + +=cut
\ No newline at end of file diff --git a/share/skin/default/layout/display_field/number b/share/skin/default/layout/display_field/number new file mode 100644 index 0000000..e531148 --- /dev/null +++ b/share/skin/default/layout/display_field/number @@ -0,0 +1,13 @@ +=for layout widget + +[% content %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout value + +[% content %] + +=cut diff --git a/share/skin/default/layout/display_field/related_object b/share/skin/default/layout/display_field/related_object new file mode 100644 index 0000000..e531148 --- /dev/null +++ b/share/skin/default/layout/display_field/related_object @@ -0,0 +1,13 @@ +=for layout widget + +[% content %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout value + +[% content %] + +=cut diff --git a/share/skin/default/layout/display_field/string b/share/skin/default/layout/display_field/string new file mode 100644 index 0000000..dae2f22 --- /dev/null +++ b/share/skin/default/layout/display_field/string @@ -0,0 +1,13 @@ +=for layout widget + +[% content %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout value + +[% content %] + +=cut
\ No newline at end of file diff --git a/share/skin/default/layout/display_field/text b/share/skin/default/layout/display_field/text new file mode 100644 index 0000000..dae2f22 --- /dev/null +++ b/share/skin/default/layout/display_field/text @@ -0,0 +1,13 @@ +=for layout widget + +[% content %] + +=for layout label + +<strong > [ % content %]: </strong> + +=for layout value + +[% content %] + +=cut
\ No newline at end of file diff --git a/share/skin/default/layout/field/boolean b/share/skin/default/layout/field/boolean new file mode 100644 index 0000000..2ee1da2 --- /dev/null +++ b/share/skin/default/layout/field/boolean @@ -0,0 +1,32 @@ +=for layout widget + +[% label %] [% field %] [% message %] <br> + +=for layout field + +[% + IF content; + checked = 'checked="checked"'; + ELSE; + checked = ""; + END; +%] + +<!-- We need a replacement for process_attrs --> +<input type="checkbox" id="[% id | html %]" name="[% name | html %]" value="1" [% checked %] /> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut diff --git a/share/skin/default/layout/field/choose_many b/share/skin/default/layout/field/choose_many new file mode 100644 index 0000000..8781021 --- /dev/null +++ b/share/skin/default/layout/field/choose_many @@ -0,0 +1,66 @@ +=for layout widget + +[% label %] +<br /> +[% message %] +[% field %] + +=for layout field + +<table> + <tr> + <td> [% available_values %] </td> + <td> [% action_buttons %] </td> + <td> + [% selected_values %] + [% current_values %] + </td> + </tr> +</table> + +=for layout available_values + +<select size="10" multiple="multiple" name="[% viewport.event_id_for('add_values') | html %]"> + [% content %] +</select> + +=for layout selected_values + +<select size="10" multiple="multiple" name="[% viewport.event_id_for('remove_values') | html %]"> + [% content %] +</select> + +=for layout current_values + +[% content %] + +=for layout hidden_value + +<input type="hidden" name="[% viewport.event_id_for('value') | html %]" value="[% content | html %]"> + +=for layout option + +<option value="[% v_value | html %]">[% v_name | html %]</option> + +=for layout action_buttons + +<input type="submit" value=">>" name="[% viewport.event_id_for('add_all_values') | html %]" /> +<input type="submit" value=">" name="[% viewport.event_id_for('do_add_values') | html %]" /> <br /> +<input type="submit" value="<" name="[% viewport.event_id_for('do_remove_values') | html %]" /> <br /> +<input type="submit" value="<<" name="[% viewport.event_id_for('remove_all_values') | html %]" /> <br /> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> <br /> +[% END %] + +=cut diff --git a/share/skin/default/layout/field/choose_one b/share/skin/default/layout/field/choose_one new file mode 100644 index 0000000..2378ff5 --- /dev/null +++ b/share/skin/default/layout/field/choose_one @@ -0,0 +1,40 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +<!-- We need a replacement for process_attrs --> +<select name="[% name | html %]" id="[% id | html %]"> + [% IF is_required %] + <option value="">--</option> + [% END %] + [% content %] +</select> + +=for layout option + + [% IF is_selected; + selected = ' selected="selected"'; + ELSE; + selected = ''; + END; + %] + <!-- I should convert this stuff to process_attrs to keep it cleaner --> + <option value="[% v_value | html%]" [% selected %]> [% v_name | html %]</option> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut diff --git a/share/skin/default/layout/field/date_time b/share/skin/default/layout/field/date_time new file mode 100644 index 0000000..b8dd3ea --- /dev/null +++ b/share/skin/default/layout/field/date_time @@ -0,0 +1,24 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +<!-- We need a replacement for process_attrs --> +<input type="text" name="[% name | html %]" id="[% id | html%]" value="[% content | html %]" /> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut diff --git a/share/skin/default/layout/field/file b/share/skin/default/layout/field/file new file mode 100644 index 0000000..4c95907 --- /dev/null +++ b/share/skin/default/layout/field/file @@ -0,0 +1,23 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +<input type="file" name="[% name | html%]" id="[% id | html %]" /> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut diff --git a/share/skin/default/layout/field/hidden_array b/share/skin/default/layout/field/hidden_array new file mode 100644 index 0000000..ebc06af --- /dev/null +++ b/share/skin/default/layout/field/hidden_array @@ -0,0 +1,17 @@ +=for layout widget + +[% field %] + +=for layout field + +[% item %] + +=for layout item + +<input type="hidden" name="[% name | html %]" value="[% content | html %]" /> + +=for layout label + +=for layout message + +=cut diff --git a/share/skin/default/layout/field/number b/share/skin/default/layout/field/number new file mode 100644 index 0000000..eaa9593 --- /dev/null +++ b/share/skin/default/layout/field/number @@ -0,0 +1,24 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +<!-- We need a replacement for process_attrs --> +<input type="text" name="[% name | html%]" id="[% id | html %]" value="[% content | html %]" /> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut
\ No newline at end of file diff --git a/share/skin/default/layout/field/password b/share/skin/default/layout/field/password new file mode 100644 index 0000000..ec42e2a --- /dev/null +++ b/share/skin/default/layout/field/password @@ -0,0 +1,24 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +<!-- We need a replacement for process_attrs --> +<input type="password" name="[% name | html %]" id="[% id | html %]" value="[% content | html %]" /> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut
\ No newline at end of file diff --git a/share/skin/default/layout/field/string b/share/skin/default/layout/field/string new file mode 100644 index 0000000..a17c243 --- /dev/null +++ b/share/skin/default/layout/field/string @@ -0,0 +1,24 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +<!-- We need a replacement for process_attrs --> +<input type="text" name="[% name | html %]" id="[% id | html %]" value="[% content | html %]" /> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut diff --git a/share/skin/default/layout/field/text b/share/skin/default/layout/field/text new file mode 100644 index 0000000..0c6118a --- /dev/null +++ b/share/skin/default/layout/field/text @@ -0,0 +1,26 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +<!-- We need a replacement for process_attrs --> +<textarea name="[% name | html %]" id="[% id | html %]"> + [% content | html %] +</textarea> + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut diff --git a/share/skin/default/layout/field/time_range b/share/skin/default/layout/field/time_range new file mode 100644 index 0000000..7b3bb6b --- /dev/null +++ b/share/skin/default/layout/field/time_range @@ -0,0 +1,23 @@ +=for layout widget + +[% label %] [% field %] [% message %] + +=for layout field + +TODO + +=for layout label + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <label for="[% id | html %]"> [% content | html %]: </label> +[% END %] + +=for layout message + +<!-- This conditional goes away when mst comes up with something better --> +[% IF content %] + <span> [% content | html %] </span> +[% END %] + +=cut diff --git a/share/skin/default/layout/list_view b/share/skin/default/layout/list_view new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/share/skin/default/layout/list_view diff --git a/share/skin/default/layout/object_view b/share/skin/default/layout/object_view new file mode 100644 index 0000000..41a16e8 --- /dev/null +++ b/share/skin/default/layout/object_view @@ -0,0 +1,9 @@ +=for layout widget + + [% fields %] + +=for layout fields + + [% content %]<br> + +=cut |