Commit | Line | Data |
7adfd53f |
1 | package ComponentUI::Controller::Root; |
2 | |
3 | use strict; |
4 | use warnings; |
89b70ba7 |
5 | use base 'Reaction::UI::Controller::Root'; |
7adfd53f |
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( |
6ab43711 |
15 | view_name => 'Site', |
7adfd53f |
16 | window_title => 'Reaction Test App', |
6ab43711 |
17 | namespace => '' |
7adfd53f |
18 | ); |
19 | |
20 | sub base :Chained('/') :PathPart('') :CaptureArgs(0) { |
21 | my ($self, $c) = @_; |
6ab43711 |
22 | $self->push_viewport(ViewPort, layout => 'layout'); |
7adfd53f |
23 | } |
24 | |
25 | sub root :Chained('base') :PathPart('') :Args(0) { |
26 | my ($self, $c) = @_; |
27 | $self->push_viewport(ViewPort, layout => 'index'); |
28 | } |
29 | |
6ab43711 |
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 | |
7adfd53f |
42 | 1; |