From 7adfd53f17f66ffe93763e944ed1d3fc52a369dc Mon Sep 17 00:00:00 2001 From: matthewt Date: Wed, 12 Sep 2007 18:11:34 +0000 Subject: moved shit to trunk --- lib/ComponentUI/Controller/Bar.pm | 17 ++++++++++++ lib/ComponentUI/Controller/Baz.pm | 14 ++++++++++ lib/ComponentUI/Controller/Foo.pm | 14 ++++++++++ lib/ComponentUI/Controller/Root.pm | 31 ++++++++++++++++++++++ lib/ComponentUI/Controller/TestModel/Bar.pm | 15 +++++++++++ lib/ComponentUI/Controller/TestModel/Baz.pm | 12 +++++++++ lib/ComponentUI/Controller/TestModel/Foo.pm | 12 +++++++++ lib/ComponentUI/Model/Action.pm | 16 +++++++++++ lib/ComponentUI/Model/TestDB.pm | 11 ++++++++ lib/ComponentUI/Model/TestModel.pm | 12 +++++++++ lib/ComponentUI/TestModel.pm | 19 +++++++++++++ lib/ComponentUI/TestModel/Bars.pm | 21 +++++++++++++++ lib/ComponentUI/TestModel/Baz.pm | 21 +++++++++++++++ lib/ComponentUI/TestModel/Foo.pm | 22 +++++++++++++++ .../TestModel/Foo/Action/CustomAction.pm | 9 +++++++ lib/ComponentUI/View/XHTML.pm | 7 +++++ 16 files changed, 253 insertions(+) create mode 100644 lib/ComponentUI/Controller/Bar.pm create mode 100644 lib/ComponentUI/Controller/Baz.pm create mode 100644 lib/ComponentUI/Controller/Foo.pm create mode 100644 lib/ComponentUI/Controller/Root.pm create mode 100644 lib/ComponentUI/Controller/TestModel/Bar.pm create mode 100644 lib/ComponentUI/Controller/TestModel/Baz.pm create mode 100644 lib/ComponentUI/Controller/TestModel/Foo.pm create mode 100644 lib/ComponentUI/Model/Action.pm create mode 100644 lib/ComponentUI/Model/TestDB.pm create mode 100644 lib/ComponentUI/Model/TestModel.pm create mode 100644 lib/ComponentUI/TestModel.pm create mode 100644 lib/ComponentUI/TestModel/Bars.pm create mode 100644 lib/ComponentUI/TestModel/Baz.pm create mode 100644 lib/ComponentUI/TestModel/Foo.pm create mode 100644 lib/ComponentUI/TestModel/Foo/Action/CustomAction.pm create mode 100644 lib/ComponentUI/View/XHTML.pm (limited to 'lib/ComponentUI') 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; -- cgit v1.2.3-54-g00ecf