} grep { !/^_/ } keys %$args
};
- # if there's an _ key that's our current topic (decalarative syntax
- # sees $_ as $_{_}) so build an iterator around it.
-
- # There's possibly a case for making everything an iterator but I think
- # any fragment should only have a single multiple arg
-
- # we also create a 'pos' shortcut to content.pos for brevity
-
- if (my $topic = $args->{_}) {
- my $iter = $self->iter_class->new(
- $topic, $self
- );
- $tt_args->{content} = $iter;
- $tt_args->{pos} = sub { $iter->pos };
- }
$body .= $lset->tt_view->include($fname, $tt_args);
#warn "rendered ${fname}, body length now ".length($body)."\n";
};
return '';
};
+ implements 'value_string' => as { shift->value };
+
};
1;
use Reaction::UI::WidgetClass;
class DisplayField, which {
- fragment widget [ qw/label value/ ];
- fragment label [ string { $_{viewport}->label } ];
- fragment value [ string { $_{viewport}->value } ];
+
+ before fragment widget {
+ arg label => $_{viewport}->label;
+ arg value => $_{viewport}->value_string;
+ };
+
};
1;
use Reaction::UI::WidgetClass;
class Boolean is 'Reaction::UI::Widget::DisplayField', which {
- fragment value [ string { $_{viewport}->value_string } ];
+
};
1;
use Reaction::UI::WidgetClass;
class Collection, which {
- fragment widget [ qw/label list/ ];
- fragment label [ string { $_{viewport}->label } ];
- fragment list [ item => over func('viewport', 'value_names') ];
- fragment item [ string { $_ } ];
+
+ before fragment widget {
+ arg 'label' => $_{viewport}->label;
+ };
+
+ implements fragment list {
+ render 'item' => over $_{viewport}->value_names;
+ };
+
+ implements fragment item {
+ arg 'name' => $_;
+ };
+
};
1;
use Reaction::UI::WidgetClass;
class DateTime is 'Reaction::UI::Widget::DisplayField', which {
- fragment value [ string { $_{viewport}->value_string } ];
+
};
1;
use Reaction::UI::WidgetClass;
class RelatedObject is 'Reaction::UI::Widget::DisplayField', which {
- fragment value [ string { $_{viewport}->value_string } ];
+
};
1;
use Reaction::UI::WidgetClass;
class ObjectView, which {
- fragment widget [ 'field_list' ];
- fragment field_list [ field => over func('viewport', 'ordered_fields') ];
- fragment field [ 'viewport' ];
+
+ implements fragment field_list {
+ render field => over $_{viewport}->ordered_fields;
+ };
+
+ implements fragment field {
+ render 'viewport';
+ };
+
};
1;
implements handle_fragment => as {
my ($self, $name, $proto, $code) = @_;
-warn ($self, $name, $code);
+#warn ($self, $name, $code);
return ("_fragment_${name}" => $self->wrap_as_fragment($code));
};
local $current_widget = $_[0];
local $do_render = $_[1];
local *_ = \%{$_[2]};
+ local $_ = $_[2]->{_};
local $new_args = $_[3];
$code->(@_);
};
=for layout widget
-[% content %]
+[% label_layout %]
+[% value_layout %]
-=for layout label
+=for layout label_layout
-<strong > [% content | html %]: </strong>
+<strong > [% label %]: </strong>
-=for layout value
+=for layout value_layout
-[% content | html %]
+[% value %]
-=cut
\ No newline at end of file
+=cut
=for layout widget
-[% label %]
+[% label_box %]
[% list %]
-=for layout label
+=for layout label_box
-<strong > [% content | html %]: </strong>
+<strong> [% label %]: </strong>
=for layout list
<ul>
-[% content %]
+[% call_next %]
</ul>
=for layout item
-<li>[% content | html %]</li>
+<li>[% name %]</li>
=cut
=for layout widget
-[% content %]
+[% label_layout %]
+[% value_layout %]
-=for layout label
+=for layout label_layout
-<strong> [% content | html %]: </strong>
+<strong > [% label %]: </strong>
-=for layout value
+=for layout value_layout
-[% content | html %]
+[% value %]
=cut
=for layout widget
-[% content %]
+[% label_layout %]
+[% value_layout %]
-=for layout label
+=for layout label_layout
-<strong> [% content | html %]: </strong>
+<strong > [% label %]: </strong>
-=for layout value
+=for layout value_layout
-[% content | html %]
+[% value %]
=cut
=for layout widget
-[% content %]
+[% label_layout %]
+[% value_layout %]
-=for layout label
+=for layout label_layout
-<strong> [% content | html %]: </strong>
+<strong > [% label %]: </strong>
-=for layout value
+=for layout value_layout
-[% content | html %]
+[% value %]
=cut
=for layout widget
-[% content %]
+[% label_layout %]
+[% value_layout %]
-=for layout label
+=for layout label_layout
-<strong> [% content | html %]: </strong>
+<strong > [% label %]: </strong>
-=for layout value
+=for layout value_layout
-[% content | html %]
+[% value %]
-=cut
\ No newline at end of file
+=cut
=for layout widget
-[% content %]
+[% label_layout %]
+[% value_layout %]
-=for layout label
+=for layout label_layout
-<strong> [% content | html %]: </strong>
+<strong > [% label %]: </strong>
-=for layout value
+=for layout value_layout
-[% content | html %]
+[% value %]
-=cut
\ No newline at end of file
+=cut
[% field_list %]
-=for layout field_list
-
- <p> [% content %] </p>
-
-=cut
-
=for layout field
- [% content %] <br>
+ [% call_next %] <br>
=cut