fix for lack of remote_user
[catagits/Reaction.git] / lib / ComponentUI / Controller / Root.pm
CommitLineData
7adfd53f 1package ComponentUI::Controller::Root;
2
3use strict;
4use warnings;
90bcd4d7 5
26fa3b8a 6use Moose;
90bcd4d7 7BEGIN { extends 'Reaction::UI::Controller::Root'; }
7adfd53f 8
9use aliased 'Reaction::UI::ViewPort';
8a293e2e 10use aliased 'Reaction::UI::ViewPort::SiteLayout';
7adfd53f 11
12#
13# Sets the actions in this controller to be registered with no prefix
14# so they function identically to actions created in MyApp.pm
15#
16__PACKAGE__->config(
6ab43711 17 view_name => 'Site',
7adfd53f 18 window_title => 'Reaction Test App',
6ab43711 19 namespace => ''
7adfd53f 20);
21
22sub base :Chained('/') :PathPart('') :CaptureArgs(0) {
23 my ($self, $c) = @_;
8a293e2e 24 $self->push_viewport(SiteLayout,
25 title => 'ComponentUI test title',
68404faa 26 static_base_uri => "${\$c->uri_for('/static')}",
5194f504 27 meta_info => {
28 http_header => {
29 'Content-Type' => 'text/html;charset=utf-8',
30 },
31 },
8a293e2e 32 );
7adfd53f 33}
34
35sub root :Chained('base') :PathPart('') :Args(0) {
36 my ($self, $c) = @_;
4ad1eed3 37 $self->push_viewport(
38 ViewPort, (
39 layout => 'index',
40 layout_args => {
ab20681f 41 user_agent => $c->request->user_agent || '',
4ad1eed3 42 message_to_layout => 'I hate programming.',
43 },
44 ),
45 );
b52bfa73 46 $c->log->debug('remote', $c->request->remote_user || '' );
7adfd53f 47}
48
0209ee1b 49sub bye :Chained('base') :PathPart('bye') :Args(0) {
50 exit;
51}
52
6ab43711 53sub static :Chained('base') :PathPart('static') :Args {
54 my ($self, $c, @args) = @_;
55 return if $c->stash->{window}->view->serve_static_file($c, \@args);
56 $c->forward('error_404');
57}
58
59sub error_404 :Private {
60 my ($self, $c) = @_;
61 $c->res->body("Error 404");
62 $c->res->status(404);
63}
64
7adfd53f 651;