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