+++ /dev/null
-package ComponentUI::View::XHTML;
-
-use Reaction::Class;
-
-extends 'Reaction::UI::Renderer::XHTML';
-
-1;
class DBIC, which {
+ has make_classes_immutable => (isa => "Bool", is => "rw", required => 1, default => sub{ 1 });
+
#user defined actions and prototypes
has object_actions => (isa => "HashRef", is => "rw", lazy_build => 1);
has collection_actions => (isa => "HashRef", is => "rw", lazy_build => 1);
my $sources = $self->parse_reflect_rules($rules, $haystack);
- my $make_immutable = $meta->is_immutable;
+ my $make_immutable = $meta->is_immutable || $self->make_classes_immutable;
$meta->make_mutable if $meta->is_immutable;
$meta->add_domain_model
my $meta = eval { Class::MOP::load_class($class) } ?
$class->meta : $base->meta->create( $class, superclasses => [ $base ]);
- my $make_immutable = $meta->is_immutable;
+ my $make_immutable = $meta->is_immutable || $self->make_classes_immutable;;
$meta->make_mutable if $meta->is_immutable;
$meta->add_method(_build_im_class => sub{ $object } );
#XXX as a default pass the domain model as a target_model until i come up with something
$dm_opts->{is} ||= 'rw';
$dm_opts->{required} ||= 1;
- my $make_immutable = $meta->is_immutable;
+ my $make_immutable = $meta->is_immutable || $self->make_classes_immutable;;
$meta->make_mutable if $meta->is_immutable;
my $dm_attr = $meta->add_domain_model($dm_name, %$dm_opts);
#create the class
my $meta = eval { Class::MOP::load_class($class) } ?
$class->meta : $base->meta->create($class, superclasses => [$base]);
- my $make_immutable = $meta->is_immutable;
+ my $make_immutable = $meta->is_immutable || $self->make_classes_immutable;
$meta->make_mutable if $meta->is_immutable;
for my $attr_name (keys %$attributes){
class View which {
- has '_layout_set_cache' => (is => 'ro', default => sub { {} });
+ has '_layout_set_cache' => (is => 'ro', default => sub { {} });
+ has '_widget_class_cache' => (is => 'ro', default => sub { {} });
has 'app' => (is => 'ro', required => 1);
my ($self, $layout_set) = @_;
my $base = $self->blessed;
my $tail = $layout_set->widget_type;
+ my $lset_name = $layout_set->name;
# eventually more stuff will go here i guess?
my $app_name = ref $self->app || $self->app;
+ my $cache = $self->_widget_class_cache;
+ return $cache->{ $lset_name } if exists $cache->{ $lset_name };
my @search_path = ($base, $app_name, 'Reaction::UI');
my @haystack = map { join '::', $_, 'Widget', $tail } @search_path;
for my $class (@haystack){
eval { Class::MOP::load_class($class) };
- $@ ? next : return $class;
+ #$@ ? next : return $class;
+ $@ ? next : return $cache->{ $lset_name } = $class;
}
confess "Couldn't load widget '$tail': tried: @haystack";
};
my $tried_isa = 0;
CONSTRAINT: while (defined($constraint)) {
my $name = $constraint->name;
+ $name = $attr->_isa_metadata if($name eq '__ANON__');
if (eval { $name->can('meta') } && !$tried_isa++) {
foreach my $class ($name->meta->class_precedence_list) {
my $mangled_name = $class;
implements build_label => as {
my ($self) = @_;
my $label = join(' ', map { ucfirst } split('_', $self->name));
- print STDERR "Field " . $self->name . " has label '$label'\n";
+ # print STDERR "Field " . $self->name . " has label '$label'\n";
return $label;
};
my $tried_isa = 0;
CONSTRAINT: while (defined($constraint)) {
my $name = $constraint->name;
+ $name = $attr->_isa_metadata if($name eq '__ANON__');
if (eval { $name->can('meta') } && !$tried_isa++) {
foreach my $class ($name->meta->class_precedence_list) {
my $mangled_name = $class;
my $tried_isa = 0;
CONSTRAINT: while (defined($constraint)) {
my $name = $constraint->name;
+ $name = $attr->_isa_metadata if($name eq '__ANON__');
if (eval { $name->can('meta') } && !$tried_isa++) {
foreach my $class ($name->meta->class_precedence_list) {
my $mangled_name = $class;
--- /dev/null
+=for layout widget
+
+<tr>
+ [% content %]
+<tr>
+
+=for layout cells
+
+[% content %]
+
+=for layout cell
+
+<td>[% content %]</td>
+
+=cut
\ No newline at end of file
--- /dev/null
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { use_ok 'Catalyst::Test', 'ComponentUI' }
+
+
+my $i = 1;
+for(30..60){
+ ok( request('/')->is_success, 'Request should succeed' );
+ ok( request('/testmodel/foo')->is_success, 'Request should succeed' );
+ ok( request('/testmodel/baz')->is_success, 'Request should succeed' );
+ ok( request("/testmodel/foo/id/${_}/update")->is_success, 'Request should succeed' );
+ ok( request("/testmodel/foo/id/${_}/view")->is_success, 'Request should succeed' );
+
+ $i = 1 if $i > 4;
+ ok( request("/testmodel/baz/id/${i}/update")->is_success, 'Request should succeed' );
+ ok( request("/testmodel/baz/id/${i}/view")->is_success, 'Request should succeed' );
+ $i++;
+}
+
+
+