aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoromega <omega@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-06-22 18:50:25 +0000
committeromega <omega@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-06-22 18:50:25 +0000
commit888532d3340836e468a5572c44893f58e0202ed5 (patch)
treeefba09fcb270fd7c02712c9be12c8ee671500f34
parent6f51eb8562a023cd9ddf6a2ad09f0f416673b079 (diff)
downloadreaction-888532d3340836e468a5572c44893f58e0202ed5.tar.gz
reaction-888532d3340836e468a5572c44893f58e0202ed5.zip
fix some merge problems
-rw-r--r--lib/Catalyst/Model/Reaction/InterfaceModel/DBIC.pm1
-rw-r--r--lib/Reaction/InterfaceModel/Reflector/DBIC.pm3
-rw-r--r--lib/Reaction/Manual/Intro.pod72
-rw-r--r--lib/Reaction/UI/Skin.pm24
4 files changed, 94 insertions, 6 deletions
diff --git a/lib/Catalyst/Model/Reaction/InterfaceModel/DBIC.pm b/lib/Catalyst/Model/Reaction/InterfaceModel/DBIC.pm
index e0abf71..4c6534f 100644
--- a/lib/Catalyst/Model/Reaction/InterfaceModel/DBIC.pm
+++ b/lib/Catalyst/Model/Reaction/InterfaceModel/DBIC.pm
@@ -34,7 +34,6 @@ class DBIC, is 'Reaction::Object', is 'Catalyst::Component', which {
my $params = $cfg{db_params} || {};
my $schema = $schema_class
->connect($cfg{db_dsn}, $cfg{db_user}, $cfg{db_password}, $params);
-
return $class->new(_schema => $schema, _im_class => $im_class);
};
diff --git a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
index ddd8899..41bb43f 100644
--- a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
+++ b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
@@ -688,7 +688,7 @@ class DBIC, which {
my \$rs = shift->${dm_name}->related_resultset('${attr_name}');
return ${isa}->new(_source_resultset => \$rs);
}";
- } elsif( $rel_accessor eq 'single') {
+ } elsif( $rel_accessor eq 'single' || $rel_accessor eq 'filter' ) {
#belongs_to
#type constraint is the foreign IM object, default inflates it
my $isa = $attr_opts{isa} = $self->class_name_from_source_name($parent_class, $rel_moniker);
@@ -735,7 +735,6 @@ class DBIC, which {
$attr_opts{isa} = $from_attr->_isa_metadata;
$attr_opts{default} = eval "sub{ shift->${dm_name}->${reader} }";
}
-
return \%attr_opts;
};
diff --git a/lib/Reaction/Manual/Intro.pod b/lib/Reaction/Manual/Intro.pod
index 523e5e8..7be7002 100644
--- a/lib/Reaction/Manual/Intro.pod
+++ b/lib/Reaction/Manual/Intro.pod
@@ -66,6 +66,31 @@ by Reaction to build the interface components. If you're not familiar with
L<DBIx::Class> or don't have a schema handy, now is a good time to go through
L<DBIx::Class::Manual::Intro> to get a schema set up.
+It is important that your Result-objects implement the meta-protocol of Moose
+One way to achive that is to do the following:
+
+ package MyApp::Schema::Result::Bar;
+ use base 'DBIx::Class';
+ use Moose;
+
+ has 'name' => (isa => 'Str', required => 1);
+
+ use namespace::clean -except => [ 'meta' ];
+
+ __PACKAGE__->load_components(qw(Core));
+ __PACKAGE__->table('bar');
+ __PACKAGE__->add_columns(
+ name => {
+ data_type => 'varchar',
+ size => 255,
+ is_nullable => 0,
+ }
+ );
+ __PACKAGE__->primary_key('name');
+ 1;
+
+Once you have your schema set up like that, you can create the InferfaceModel:
+
package MyApp::InterfaceModel::DBIC;
use base 'Reaction::InterfaceModel::Object';
@@ -81,8 +106,23 @@ L<DBIx::Class::Manual::Intro> to get a schema set up.
1;
+Then you create a MyApp::Model that uses this InferfaceModel:
+
+ package Myapp::Model::IM;
+
+
+ use Reaction::Class;
+
+ class IM is 'Catalyst::Model::Reaction::InterfaceModel::DBIC', which {
+
+ };
+
+ 1;
+
=head2 Controllers
+=head3 Root controller
+
Your Reaction application must have a Root controller which inherits from
C<Reaction::UI::Controller::Root>.
@@ -100,10 +140,42 @@ C<Reaction::UI::Controller::Root>.
1;
+=head3 Individual controllers
+
+For each Collection(table?) in your DB, you need to create a controller
+
+ package MyApp::Controller::Foo;
+
+ use base 'Reaction::UI::Controller::Collection::CRUD';
+ use Reaction::Class;
+
+ __PACKAGE__->config(
+ model_name => 'IM', # This corresponds to the name of the MyApp::Model you created earlier
+ collection_name => 'Foo', # Name of one of the sources in your InterfaceModel
+ action => { base => { Chained => '/base', PathPart => 'foo' } },
+ );
+
+ 1;
+
XX TODO
=head2 View
+One of the views in your application should look something like this:
+
+ package MyApp::View::TT;
+
+ use Reaction::Class;
+
+ class TT is 'Reaction::UI::View::TT', which {
+
+ };
+
+ 1;
+
+ __END__;
+
+
XX TODO
=head1 SEE ALSO
diff --git a/lib/Reaction/UI/Skin.pm b/lib/Reaction/UI/Skin.pm
index a875366..42b3189 100644
--- a/lib/Reaction/UI/Skin.pm
+++ b/lib/Reaction/UI/Skin.pm
@@ -6,6 +6,7 @@ use Reaction::Class;
use Reaction::UI::LayoutSet;
use Reaction::UI::RenderingContext;
use File::ShareDir;
+use File::Basename;
use aliased 'Path::Class::Dir';
@@ -41,9 +42,26 @@ class Skin which {
my $skin_name = $self->name;
if ($skin_name =~ s!^/(.*?)/!!) {
my $dist = $1;
- $args->{skin_base_dir} =
- Dir->new(File::ShareDir::dist_dir($dist))
- ->subdir('skin');
+ $args->{skin_base_dir} = eval {
+ Dir->new(File::ShareDir::dist_dir($dist))
+ ->subdir('skin');
+ };
+ if ($@) {
+ # No installed Reaction
+ my $file = __FILE__;
+ my $dir = Dir->new(dirname($file));
+ my $skin_base;
+ while ($dir->parent) {
+ if (-d $dir->subdir('share') && -d $dir->subdir('share')->subdir('skin')) {
+ $skin_base = $dir->subdir('share')->subdir('skin');
+ last;
+ }
+ $dir = $dir->parent;
+ }
+ confess "could not find skinbase by recursion. ended up at $dir, from $file"
+ unless $skin_base;
+ $args->{skin_base_dir} = $skin_base;
+ }
}
my $base = $args->{skin_base_dir}->subdir($skin_name);
confess "No such skin base directory ${base}"