-Debug is -stupid-
[catagits/Reaction.git] / lib / ComponentUI / Controller / Root.pm
1 package ComponentUI::Controller::Root;
2
3 use strict;
4 use warnings;
5 use base 'Reaction::UI::Controller::Root';
6 use Reaction::Class;
7
8 use aliased 'Reaction::UI::ViewPort';
9
10 #
11 # Sets the actions in this controller to be registered with no prefix
12 # so they function identically to actions created in MyApp.pm
13 #
14 __PACKAGE__->config(
15   view_name => 'Site',
16   window_title => 'Reaction Test App',
17   namespace => ''
18 );
19
20 sub base :Chained('/') :PathPart('') :CaptureArgs(0) {
21   my ($self, $c) = @_;
22   $self->push_viewport(ViewPort, layout => 'layout');
23 }
24
25 sub root :Chained('base') :PathPart('') :Args(0) {
26   my ($self, $c) = @_;
27   $self->push_viewport(ViewPort, layout => 'index');
28 }
29
30 sub static :Chained('base') :PathPart('static') :Args {
31   my ($self, $c, @args) = @_;
32   return if $c->stash->{window}->view->serve_static_file($c, \@args);
33   $c->forward('error_404');
34 }
35
36 sub error_404 :Private {
37   my ($self, $c) = @_;
38   $c->res->body("Error 404");
39   $c->res->status(404);
40 }
41
42 1;