From 6ab43711ccd779eedce107001b300043e2056a0c Mon Sep 17 00:00:00 2001 From: groditi Date: Sat, 29 Sep 2007 20:40:12 +0000 Subject: It is starting to look like this may actually work after all. Listview is the only one left i think, although the bar tests are still giving me trouble. TODO: add to the collection actions a truncate action. should be useful --- lib/ComponentUI/Controller/Root.pm | 19 ++++++++++++---- lib/ComponentUI/View/Site.pm | 36 ++++++++++++++++++++++++++++++ lib/ComponentUI/View/Site/Widget/Index.pm | 11 +++++++++ lib/ComponentUI/View/Site/Widget/Layout.pm | 17 ++++++++++++++ 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 lib/ComponentUI/View/Site.pm create mode 100644 lib/ComponentUI/View/Site/Widget/Index.pm create mode 100644 lib/ComponentUI/View/Site/Widget/Layout.pm (limited to 'lib/ComponentUI') diff --git a/lib/ComponentUI/Controller/Root.pm b/lib/ComponentUI/Controller/Root.pm index 1d7bd58..567cf3b 100644 --- a/lib/ComponentUI/Controller/Root.pm +++ b/lib/ComponentUI/Controller/Root.pm @@ -12,15 +12,14 @@ use aliased 'Reaction::UI::ViewPort'; # so they function identically to actions created in MyApp.pm # __PACKAGE__->config( - view_name => 'XHTML', + view_name => 'Site', window_title => 'Reaction Test App', - content_type => 'text/html', - namespace => '', + namespace => '' ); sub base :Chained('/') :PathPart('') :CaptureArgs(0) { my ($self, $c) = @_; - $self->push_viewport(ViewPort, layout => 'xhtml'); + $self->push_viewport(ViewPort, layout => 'layout'); } sub root :Chained('base') :PathPart('') :Args(0) { @@ -28,4 +27,16 @@ sub root :Chained('base') :PathPart('') :Args(0) { $self->push_viewport(ViewPort, layout => 'index'); } +sub static :Chained('base') :PathPart('static') :Args { + my ($self, $c, @args) = @_; + return if $c->stash->{window}->view->serve_static_file($c, \@args); + $c->forward('error_404'); +} + +sub error_404 :Private { + my ($self, $c) = @_; + $c->res->body("Error 404"); + $c->res->status(404); +} + 1; diff --git a/lib/ComponentUI/View/Site.pm b/lib/ComponentUI/View/Site.pm new file mode 100644 index 0000000..cbb2d28 --- /dev/null +++ b/lib/ComponentUI/View/Site.pm @@ -0,0 +1,36 @@ +package ComponentUI::View::Site; + +use Reaction::Class; +use aliased 'Reaction::UI::View::TT'; + +class Site is TT, which { + +}; + + +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; diff --git a/lib/ComponentUI/View/Site/Widget/Index.pm b/lib/ComponentUI/View/Site/Widget/Index.pm new file mode 100644 index 0000000..21175ae --- /dev/null +++ b/lib/ComponentUI/View/Site/Widget/Index.pm @@ -0,0 +1,11 @@ +package ComponentUI::View::Site::Widget::Index; + +use Reaction::UI::WidgetClass; + +class Index which { + + widget renders [ string {"DUMMY"} ]; + +}; + +1; diff --git a/lib/ComponentUI/View/Site/Widget/Layout.pm b/lib/ComponentUI/View/Site/Widget/Layout.pm new file mode 100644 index 0000000..380a03a --- /dev/null +++ b/lib/ComponentUI/View/Site/Widget/Layout.pm @@ -0,0 +1,17 @@ +package ComponentUI::View::Site::Widget::Layout; + +use Reaction::UI::WidgetClass; + +class Layout which { + + widget renders [ qw(menu sidebar header main_content) => + { viewport => func('self', 'viewport') } ]; + + menu renders [ string { "DUMMY" } ]; + sidebar renders [ string { "Sidebar Shit" } ]; + header renders [ string { "DUMMY" } ]; + main_content renders [ viewport over func('viewport', 'inner')]; + +}; + +1; -- cgit v1.2.3-54-g00ecf