use Reaction::UI::WidgetClass;
class ActionForm, which {
- fragment widget [ qw/header field_list buttons footer/ ]
- => {id => sub { $_{viewport}->location } };
-
- fragment field_list [field => over func('viewport','ordered_fields')];
- fragment field [ 'viewport' ];
-
- #move button logic here
- fragment buttons [ string {"DUMMY"} ],
- { message => sub{ $_{viewport}->can('message') ? $_{viewport}->message : "" },
- ok_label => func(viewport => 'ok_label'),
- close_label => func(viewport => 'close_label'),
- apply_label => func(viewport => 'apply_label'),
- };
-
- fragment header [ string {"DUMMY"} ];
- fragment footer [ string {"DUMMY"} ];
+
+ #implements fragment widget {
+ # arg form_id => $_{viewport}->location;
+ #};
+
+ implements fragment field_list {
+ render field => over $_{viewport}->ordered_fields;
+ };
+
+ implements fragment field {
+ render 'viewport';
+ };
implements fragment ok_button_fragment {
if (grep { $_ eq 'ok' } $_{viewport}->accept_events) {
class ChooseMany is 'Reaction::UI::Widget::Field', which {
- fragment field [qw/available_values action_buttons selected_values current_values/];
+ implements fragment action_buttons {
+ foreach my $event (
+ qw(add_all_values do_add_values do_remove_values remove_all_values)
+ ) {
+ arg "event_id_${event}" => event_id $event;
+ }
+ };
- fragment current_values [ hidden_value => over func('viewport', 'current_value_choices') ];
- fragment hidden_value [ string { $_->{value} } ];
+ implements fragment current_values {
+ render hidden_value => over $_{viewport}->current_value_choices;
+ };
- fragment available_values [ option => over func('viewport', 'available_value_choices') ];
- fragment selected_values [ option => over func('viewport', 'current_value_choices') ];
- fragment option [string {"DUMMY"}], { v_value => sub {$_->{value}}, v_name => sub {$_->{name}} };
- fragment action_buttons [ string {"DUMMY"} ];
+ implements fragment selected_values {
+ arg event_id_remove_values => event_id 'remove_values';
+ render value_option => over $_{viewport}->current_value_choices;
+ };
implements fragment available_values {
arg event_id_add_values => event_id 'add_values';
class ChooseOne is 'Reaction::UI::Widget::Field', which {
- fragment field [ option => over func('viewport', 'value_choices') ],
- { is_required => sub{ $_{viewport}->attribute->is_required } };
-
- fragment option [string {"DUMMY"}],
- {
- v_value => sub { $_->{value} },
- v_name => sub { $_->{name} },
- is_selected => sub { $_{viewport}->is_current_value($_->{value}) },
- };
+ implements fragment option_is_required {
+ if ($_{viewport}->attribute->required) {
+ render 'options_is_required_yes';
+ } else {
+ render 'options_is_required_no';
+ }
+ };
+
+ implements fragment option_list {
+ render option => over $_{viewport}->value_choices;
+ };
implements fragment option {
arg option_name => $_->{name};
class DateTime is 'Reaction::UI::Widget::Field', which {
- fragment field [ string { $_{viewport}->value_string }, ];
-
};
1;
class HiddenArray is 'Reaction::UI::Widget::Field', which {
- fragment field [ item => over func('viewport', 'value') ];
- fragment item [ string { $_ } ];
+ implements fragment hidden_list {
+ render hidden_field => over $_{viewport}->value;
+ };
implements fragment hidden_field {
arg field_value => $_;
class ListView is 'Reaction::UI::Widget::GridView', which {
+ after fragment widget {
+ arg pager_obj => $_{viewport}->pager;
+ };
+
implements fragment actions {
render action => over $_{viewport}->actions;
};
};
implements fragment header_action_cell {
- arg 'col_count' => $_{viewport}->object_action_count;
+ arg col_count => $_{viewport}->object_action_count;
+ };
+
+ implements fragment page_list {
+ render numbered_page_fragment
+ => over [ $_{pager_obj}->first_page .. $_{pager_obj}->last_page ];
+ };
+
+ implements fragment numbered_page_fragment {
+ arg page_uri => event_uri { page => $_ };
+ arg page_number => $_;
+ if ($_{pager_obj}->current_page == $_) {
+ render 'numbered_page_this_page';
+ } else {
+ render 'numbered_page';
+ }
+ };
+
+ implements fragment first_page {
+ arg page_uri => event_uri { page => $_{pager_obj}->first_page };
+ arg page_name => 'First';
+ render 'named_page';
+ };
+
+ implements fragment last_page {
+ arg page_uri => event_uri { page => $_{pager_obj}->last_page };
+ arg page_name => 'Last';
+ render 'named_page';
+ };
+
+ implements fragment next_page {
+ arg page_name => 'Next';
+ if (my $page = $_{pager_obj}->next_page) {
+ arg page_uri => event_uri { page => $page };
+ render 'named_page';
+ } else {
+ render 'named_page_no_page';
+ }
};
implements fragment previous_page {
=for layout pager
-<p>Pager would be here. But it isn't.</p>
+<ul class="pager">
+ [% first_page %]
+ [% previous_page %]
+ [% page_list %]
+ [% next_page %]
+ [% last_page %]
+</ul>
+
+=for layout numbered_page_this_page
+
+<li> [% page_number %] </li>
+
+=for layout numbered_page
+
+<li> <a href="[% page_uri %]">[% page_number %]</a> </li>
+
+=for layout named_page
+
+<li> <a href="[% page_uri %]">[% page_name %]</a> </li>
+
+=for layout named_page_no_page
+
+<li> [% page_name %] </li>
=cut