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'; |
8a293e2e |
9 | use 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 | |
21 | sub 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')}", |
5194f504 |
26 | meta_info => { |
27 | http_header => { |
28 | 'Content-Type' => 'text/html;charset=utf-8', |
29 | }, |
30 | }, |
8a293e2e |
31 | ); |
7adfd53f |
32 | } |
33 | |
34 | sub root :Chained('base') :PathPart('') :Args(0) { |
35 | my ($self, $c) = @_; |
36 | $self->push_viewport(ViewPort, layout => 'index'); |
37 | } |
38 | |
0209ee1b |
39 | sub bye :Chained('base') :PathPart('bye') :Args(0) { |
40 | exit; |
41 | } |
42 | |
6ab43711 |
43 | sub static :Chained('base') :PathPart('static') :Args { |
44 | my ($self, $c, @args) = @_; |
45 | return if $c->stash->{window}->view->serve_static_file($c, \@args); |
46 | $c->forward('error_404'); |
47 | } |
48 | |
49 | sub error_404 :Private { |
50 | my ($self, $c) = @_; |
51 | $c->res->body("Error 404"); |
52 | $c->res->status(404); |
53 | } |
54 | |
7adfd53f |
55 | 1; |