aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ComponentUI
diff options
context:
space:
mode:
authormatthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-09-12 18:11:34 +0000
committermatthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-09-12 18:11:34 +0000
commit7adfd53f17f66ffe93763e944ed1d3fc52a369dc (patch)
tree19e599e74419b41cbbe651fd226b81e8b73551d3 /lib/ComponentUI
parentc728c97cb1061330e63c7cc048e768ef74988fe6 (diff)
downloadreaction-7adfd53f17f66ffe93763e944ed1d3fc52a369dc.tar.gz
reaction-7adfd53f17f66ffe93763e944ed1d3fc52a369dc.zip
moved shit to trunk
Diffstat (limited to 'lib/ComponentUI')
-rw-r--r--lib/ComponentUI/Controller/Bar.pm17
-rw-r--r--lib/ComponentUI/Controller/Baz.pm14
-rw-r--r--lib/ComponentUI/Controller/Foo.pm14
-rw-r--r--lib/ComponentUI/Controller/Root.pm31
-rw-r--r--lib/ComponentUI/Controller/TestModel/Bar.pm15
-rw-r--r--lib/ComponentUI/Controller/TestModel/Baz.pm12
-rw-r--r--lib/ComponentUI/Controller/TestModel/Foo.pm12
-rw-r--r--lib/ComponentUI/Model/Action.pm16
-rw-r--r--lib/ComponentUI/Model/TestDB.pm11
-rw-r--r--lib/ComponentUI/Model/TestModel.pm12
-rw-r--r--lib/ComponentUI/TestModel.pm19
-rw-r--r--lib/ComponentUI/TestModel/Bars.pm21
-rw-r--r--lib/ComponentUI/TestModel/Baz.pm21
-rw-r--r--lib/ComponentUI/TestModel/Foo.pm22
-rw-r--r--lib/ComponentUI/TestModel/Foo/Action/CustomAction.pm9
-rw-r--r--lib/ComponentUI/View/XHTML.pm7
16 files changed, 253 insertions, 0 deletions
diff --git a/lib/ComponentUI/Controller/Bar.pm b/lib/ComponentUI/Controller/Bar.pm
new file mode 100644
index 0000000..7f9d6c3
--- /dev/null
+++ b/lib/ComponentUI/Controller/Bar.pm
@@ -0,0 +1,17 @@
+package ComponentUI::Controller::Bar;
+
+use strict;
+use warnings;
+use base 'Reaction::UI::CRUDController';
+use Reaction::Class;
+
+__PACKAGE__->config(
+ model_base => 'TestDB',
+ model_name => 'Bar',
+ action => { base => { Chained => '/base', PathPart => 'bar' },
+ list => { ViewPort => { layout => 'bar_list' } },
+ update => { ViewPort => { layout => 'bar_form' } },
+ create => { ViewPort => { layout => 'bar_form' } } },
+);
+
+1;
diff --git a/lib/ComponentUI/Controller/Baz.pm b/lib/ComponentUI/Controller/Baz.pm
new file mode 100644
index 0000000..6d8e932
--- /dev/null
+++ b/lib/ComponentUI/Controller/Baz.pm
@@ -0,0 +1,14 @@
+package ComponentUI::Controller::Baz;
+
+use strict;
+use warnings;
+use base 'Reaction::UI::CRUDController';
+use Reaction::Class;
+
+__PACKAGE__->config(
+ model_base => 'TestDB',
+ model_name => 'Baz',
+ action => { base => { Chained => '/base', PathPart => 'baz' } },
+);
+
+1;
diff --git a/lib/ComponentUI/Controller/Foo.pm b/lib/ComponentUI/Controller/Foo.pm
new file mode 100644
index 0000000..88503a5
--- /dev/null
+++ b/lib/ComponentUI/Controller/Foo.pm
@@ -0,0 +1,14 @@
+package ComponentUI::Controller::Foo;
+
+use strict;
+use warnings;
+use base 'Reaction::UI::CRUDController';
+use Reaction::Class;
+
+__PACKAGE__->config(
+ model_base => 'TestDB',
+ model_name => 'Foo',
+ action => { base => { Chained => '/base', PathPart => 'foo' } },
+);
+
+1;
diff --git a/lib/ComponentUI/Controller/Root.pm b/lib/ComponentUI/Controller/Root.pm
new file mode 100644
index 0000000..1d7bd58
--- /dev/null
+++ b/lib/ComponentUI/Controller/Root.pm
@@ -0,0 +1,31 @@
+package ComponentUI::Controller::Root;
+
+use strict;
+use warnings;
+use base 'Reaction::UI::RootController';
+use Reaction::Class;
+
+use aliased 'Reaction::UI::ViewPort';
+
+#
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
+#
+__PACKAGE__->config(
+ view_name => 'XHTML',
+ window_title => 'Reaction Test App',
+ content_type => 'text/html',
+ namespace => '',
+);
+
+sub base :Chained('/') :PathPart('') :CaptureArgs(0) {
+ my ($self, $c) = @_;
+ $self->push_viewport(ViewPort, layout => 'xhtml');
+}
+
+sub root :Chained('base') :PathPart('') :Args(0) {
+ my ($self, $c) = @_;
+ $self->push_viewport(ViewPort, layout => 'index');
+}
+
+1;
diff --git a/lib/ComponentUI/Controller/TestModel/Bar.pm b/lib/ComponentUI/Controller/TestModel/Bar.pm
new file mode 100644
index 0000000..2cf7681
--- /dev/null
+++ b/lib/ComponentUI/Controller/TestModel/Bar.pm
@@ -0,0 +1,15 @@
+package ComponentUI::Controller::TestModel::Bar;
+
+use base 'Reaction::UI::CRUDController';
+use Reaction::Class;
+
+__PACKAGE__->config(
+ model_base => 'TestModel',
+ model_name => 'Bar',
+ action => { base => { Chained => '/base', PathPart => 'testmodel/bar' },
+ list => { ViewPort => { layout => 'bar_list' } },
+ update => { ViewPort => { layout => 'bar_form' } },
+ create => { ViewPort => { layout => 'bar_form' } } },
+);
+
+1;
diff --git a/lib/ComponentUI/Controller/TestModel/Baz.pm b/lib/ComponentUI/Controller/TestModel/Baz.pm
new file mode 100644
index 0000000..ada76e4
--- /dev/null
+++ b/lib/ComponentUI/Controller/TestModel/Baz.pm
@@ -0,0 +1,12 @@
+package ComponentUI::Controller::TestModel::Baz;
+
+use base 'Reaction::UI::CRUDController';
+use Reaction::Class;
+
+__PACKAGE__->config(
+ model_base => 'TestModel',
+ model_name => 'Baz',
+ action => { base => { Chained => '/base', PathPart => 'testmodel/baz' } },
+);
+
+1;
diff --git a/lib/ComponentUI/Controller/TestModel/Foo.pm b/lib/ComponentUI/Controller/TestModel/Foo.pm
new file mode 100644
index 0000000..846223e
--- /dev/null
+++ b/lib/ComponentUI/Controller/TestModel/Foo.pm
@@ -0,0 +1,12 @@
+package ComponentUI::Controller::TestModel::Foo;
+
+use base 'Reaction::UI::CRUDController';
+use Reaction::Class;
+
+__PACKAGE__->config(
+ model_base => 'TestModel',
+ model_name => 'Foo',
+ action => { base => { Chained => '/base', PathPart => 'testmodel/foo' } },
+);
+
+1;
diff --git a/lib/ComponentUI/Model/Action.pm b/lib/ComponentUI/Model/Action.pm
new file mode 100644
index 0000000..9c03bb5
--- /dev/null
+++ b/lib/ComponentUI/Model/Action.pm
@@ -0,0 +1,16 @@
+package ComponentUI::Model::Action;
+
+use Reaction::Class;
+
+use lib 't/lib';
+use RTest::TestDB;
+
+use aliased 'Reaction::InterfaceModel::Action::DBIC::ActionReflector';
+
+my $r = ActionReflector->new;
+
+$r->reflect_actions_for('RTest::TestDB::Foo' => __PACKAGE__);
+$r->reflect_actions_for('RTest::TestDB::Bar' => __PACKAGE__);
+$r->reflect_actions_for('RTest::TestDB::Baz' => __PACKAGE__);
+
+1;
diff --git a/lib/ComponentUI/Model/TestDB.pm b/lib/ComponentUI/Model/TestDB.pm
new file mode 100644
index 0000000..c2ae892
--- /dev/null
+++ b/lib/ComponentUI/Model/TestDB.pm
@@ -0,0 +1,11 @@
+package ComponentUI::Model::TestDB;
+
+use lib 't/lib';
+use base qw/Catalyst::Model::DBIC::Schema/;
+
+__PACKAGE__->config(
+ schema_class => 'RTest::TestDB',
+ connect_info => [ 'dbi:SQLite:t/var/reaction_test_withdb.db' ]
+);
+
+1;
diff --git a/lib/ComponentUI/Model/TestModel.pm b/lib/ComponentUI/Model/TestModel.pm
new file mode 100644
index 0000000..4e9732c
--- /dev/null
+++ b/lib/ComponentUI/Model/TestModel.pm
@@ -0,0 +1,12 @@
+package ComponentUI::Model::TestModel;
+
+use lib 't/lib';
+use base 'Reaction::InterfaceModel::DBIC::ModelBase';
+
+__PACKAGE__->config
+ (
+ im_class => 'ComponentUI::TestModel',
+ db_dsn => 'dbi:SQLite:t/var/reaction_test_withdb.db',
+ );
+
+1;
diff --git a/lib/ComponentUI/TestModel.pm b/lib/ComponentUI/TestModel.pm
new file mode 100644
index 0000000..98ebb22
--- /dev/null
+++ b/lib/ComponentUI/TestModel.pm
@@ -0,0 +1,19 @@
+package ComponentUI::TestModel;
+
+use lib 't/lib';
+use Reaction::InterfaceModel::DBIC::SchemaClass;
+
+class TestModel, which {
+
+ domain_model '_testdb_schema' =>
+ (
+ isa => 'RTest::TestDB',
+ reflect => [
+ 'Foo',
+ ['Bar' => 'ComponentUI::TestModel::Bars'],
+ ['Baz' => 'ComponentUI::TestModel::Baz', 'bazes' ],
+ ],
+ );
+};
+
+1;
diff --git a/lib/ComponentUI/TestModel/Bars.pm b/lib/ComponentUI/TestModel/Bars.pm
new file mode 100644
index 0000000..0319400
--- /dev/null
+++ b/lib/ComponentUI/TestModel/Bars.pm
@@ -0,0 +1,21 @@
+package ComponentUI::TestModel::Bars;
+
+use lib 't/lib';
+use Reaction::InterfaceModel::DBIC::ObjectClass;
+
+class Bars, which{
+ domain_model '_bars_store' =>
+ (isa => 'RTest::TestDB::Bar', inflate_result => 1,
+ reflect => [qw(name foo published_at avatar)],
+ );
+
+ reflect_actions
+ (
+ Create => { attrs =>[qw(name foo published_at avatar)] },
+ Update => { attrs =>[qw(name foo published_at avatar)] },
+ Delete => {},
+ );
+
+};
+
+1;
diff --git a/lib/ComponentUI/TestModel/Baz.pm b/lib/ComponentUI/TestModel/Baz.pm
new file mode 100644
index 0000000..255673d
--- /dev/null
+++ b/lib/ComponentUI/TestModel/Baz.pm
@@ -0,0 +1,21 @@
+package ComponentUI::TestModel::Baz;
+
+use lib 't/lib';
+use Reaction::InterfaceModel::DBIC::ObjectClass;
+
+class Baz, which{
+ domain_model '_baz_store' =>
+ (isa => 'RTest::TestDB::Baz', inflate_result => 1,
+ handles => ['display_name'],
+ reflect => [qw(id name foo_list)],
+ );
+
+ reflect_actions
+ (
+ Create => { attrs =>[qw(name)] },
+ Update => { attrs =>[qw(name)] },
+ Delete => {},
+ );
+};
+
+1;
diff --git a/lib/ComponentUI/TestModel/Foo.pm b/lib/ComponentUI/TestModel/Foo.pm
new file mode 100644
index 0000000..73de6b6
--- /dev/null
+++ b/lib/ComponentUI/TestModel/Foo.pm
@@ -0,0 +1,22 @@
+package ComponentUI::TestModel::Foo;
+
+use lib 't/lib';
+use Reaction::InterfaceModel::DBIC::ObjectClass;
+
+class Foo, which{
+ domain_model '_foo_store' =>
+ (isa => 'RTest::TestDB::Foo', inflate_result => 1,
+ handles => ['display_name'],
+ reflect => [qw(id first_name last_name baz_list)],
+ );
+
+ reflect_actions
+ (
+ Create => { attrs =>[qw(first_name last_name baz_list)] },
+ Update => { attrs =>[qw(first_name last_name baz_list)] },
+ Delete => {},
+ CustomAction => { attrs =>[qw(last_name baz_list)] },
+ );
+};
+
+1;
diff --git a/lib/ComponentUI/TestModel/Foo/Action/CustomAction.pm b/lib/ComponentUI/TestModel/Foo/Action/CustomAction.pm
new file mode 100644
index 0000000..e6f3707
--- /dev/null
+++ b/lib/ComponentUI/TestModel/Foo/Action/CustomAction.pm
@@ -0,0 +1,9 @@
+package ComponentUI::TestModel::Foo::Action::CustomAction;
+
+use Reaction::Class;
+
+class CustomAction is 'Reaction::InterfaceModel::Action', which {
+ has first_name => (isa => 'NonEmptySimpleStr', is => 'rw', lazy_build => 1);
+};
+
+1;
diff --git a/lib/ComponentUI/View/XHTML.pm b/lib/ComponentUI/View/XHTML.pm
new file mode 100644
index 0000000..32a5c87
--- /dev/null
+++ b/lib/ComponentUI/View/XHTML.pm
@@ -0,0 +1,7 @@
+package ComponentUI::View::XHTML;
+
+use Reaction::Class;
+
+extends 'Reaction::UI::Renderer::XHTML';
+
+1;