package ComponentUI::Model::TestModel;
use lib 't/lib';
-use base 'Catalyst::Model::Reaction::InterfaceModel::DBIC';
+use aliased 'Catalyst::Model::Reaction::InterfaceModel::DBIC';
+
+use Reaction::Class;
+
+class TestModel is DBIC, which {
+
+};
__PACKAGE__->config
(
use Reaction::Class;
use Reaction::InterfaceModel::Reflector::DBIC;
-
my $reflector = Reaction::InterfaceModel::Reflector::DBIC->new;
$reflector->reflect_schema
sources => [qw/Foo Bar Baz/],
);
+
1;
__END__;
-use Class::MOP;
-
-{
- my @reflect_widgets = qw(ActionForm ObjectView ListView
- Field::File
- Field::Password
- Field::Text DisplayField::Text
- Field::Number DisplayField::Number
- Field::String DisplayField::String
- Field::Boolean DisplayField::Boolean
- Field::DateTime DisplayField::DateTime
- Field::ChooseOne DisplayField::RelatedObject
- Field::ChooseMany DisplayField::Collection
- Field::HiddenArray DisplayField::List
- );
-
-
- for (@reflect_widgets){
- my $base = "Reaction::UI::Widget::${_}";
- my $target = "ComponentUI::View::Site::Widget::${_}";
- Class::MOP::load_class( $base );
- $base->meta->create($target, superclasses => [$base]);
- }
-}
-
-1;
$super->($class, $name, $options);
};
+__PACKAGE__->meta->make_immutable(inline_constructor => 0);
+
1;
__END__;
$super->($class, $pkg, 'attribute_metaclass' => 'Reaction::Meta::Attribute', @_ );
};
+
+__PACKAGE__->meta->make_immutable;
+
1;
widget renders [ qw/label list item/ => { viewport => func(self => 'viewport') } ];
label renders [ string { $_{viewport}->label } ];
list renders [ item over func('viewport', 'value_names') ];
- item renders [ string { $_{_} } ];
+ item renders [ string { $_ } ];
};
1;
viewport => func('self', 'viewport'), }
];
+ field renders [ string { $_{viewport}->value }, ];
+
label renders [ string { $_{viewport}->label }, ];
message renders [ string { $_{viewport}->message }, ];
- field renders [ string { $_{viewport}->value }, ];
-
};
1;
use Reaction::UI::WidgetClass;
class Value, which {
- widget renders [ qw/value/ => { viewport => func(self => 'viewport') } ];
- value renders [ string { $_{viewport}->value } ];
+ widget renders [ string {""} ],
+ { value => sub{
+ my $vp = $_{self}->{viewport};
+ $vp->can('value_string') ? $vp->value_string : $vp->value;
+ }
+ };
};
1;
use Reaction::UI::WidgetClass;
class Boolean is 'Reaction::UI::Widget::Value', which {
- value renders [ string { $_{viewport}->value_string } ];
+
};
1;
class Collection, which {
widget renders [ qw/list/ => { viewport => func(self => 'viewport') } ];
list renders [ item over func('viewport', 'value_names') ];
- item renders [ string { $_ } ];
+ item renders [ string {""} ], { value => $_ };
};
1;
use Reaction::UI::WidgetClass;
class DateTime is 'Reaction::UI::Widget::Value', which {
- value renders [ string { $_{viewport}->value_string } ];
+
};
1;
use Reaction::UI::WidgetClass;
class List, which {
- widget renders [ qw/list item/ => { viewport => func(self => 'viewport') } ];
+ widget renders [ qw/list/ => { viewport => func(self => 'viewport') } ];
list renders [ item over func('viewport', 'value_names') ];
- item renders [ string { $_{_} } ];
+ item renders [ string {""} ], { value => $_ };
};
1;
use Reaction::UI::WidgetClass;
class RelatedObject is 'Reaction::UI::Widget::Value', which {
- value renders [ string { $_{viewport}->value_string } ];
+
};
1;
=for layout widget
-[% content %]
-
-=for layout value
-
-[% content | html %]
+[% value | html %]
=cut
\ No newline at end of file
=for layout widget
-[% list %]
+[% list %]
=for layout list
=for layout item
-<li>[% content | html %]</li>
+<li>[% value | html %]</li>
=cut
=for layout widget
-[% content %]
-
-=for layout value
-
-[% content | html %]
+[% value | html %]
=cut
=for layout widget
-[% list %]
+[% list %]
=for layout list
=for layout item
-<li>[% content | html %]</li>
+<li>[% value | html %]</li>
=cut
\ No newline at end of file
=for layout widget
-[% content %]
-
-=for layout value
-
-[% content | html %]
+[% value | html %]
=cut
=for layout widget
-[% content %]
-
-=for layout value
-
-[% content | html %]
+[% value | html %]
=cut
=for layout widget
-[% content %]
-
-=for layout value
-
-[% content | html %]
+[% value | html %]
=cut
\ No newline at end of file
=for layout widget
-[% content %]
-
-=for layout value
-
-[% content | html %]
+[% value | html %]
=cut
\ No newline at end of file
{ 'foreign.id' => 'self.foo_id' }
);
+__PACKAGE__->meta->make_immutable;
+
+
1;
__PACKAGE__->has_many('links_to_foo_list' => 'RTest::TestDB::FooBaz', 'baz');
__PACKAGE__->many_to_many('foo_list' => 'links_to_foo_list' => 'foo');
+__PACKAGE__->meta->make_immutable;
+
1;
*get_baz_list = sub { [ shift->baz_list->all ] };
}
+
+__PACKAGE__->meta->make_immutable;
+
1;