Commit | Line | Data |
dbcf12a6 |
1 | package TreeOfTexts::Controller::Root; |
2 | use Moose; |
3 | use namespace::autoclean; |
4 | use TreeOfTexts::Model::Analysis qw/ run_analysis /; |
5 | |
6 | BEGIN { extends 'Catalyst::Controller' } |
7 | |
8 | # |
9 | # Sets the actions in this controller to be registered with no prefix |
10 | # so they function identically to actions created in MyApp.pm |
11 | # |
12 | __PACKAGE__->config(namespace => ''); |
13 | |
14 | =head1 NAME |
15 | |
16 | TreeOfTexts::Controller::Root - Root Controller for TreeOfTexts |
17 | |
18 | =head1 DESCRIPTION |
19 | |
20 | [enter your description here] |
21 | |
22 | =head1 METHODS |
23 | |
24 | =head2 index |
25 | |
26 | The root page (/) |
27 | |
28 | =cut |
29 | |
30 | sub index :Path :Args(0) { |
31 | my ( $self, $c ) = @_; |
32 | |
eb20780f |
33 | my $m = $c->model('Analysis'); |
34 | $c->stash->{svg} = $m->{'svg'}; |
35 | $c->stash->{variants} = $m->{'variants'}; |
0a8f09a9 |
36 | $c->stash->{text_title} = $m->{'title'}; |
732152b1 |
37 | $c->stash->{total} = $m->{'variant_count'}; |
38 | $c->stash->{genealogical} = $m->{'genealogical_count'}; |
39 | $c->stash->{conflict} = $m->{'conflict_count'}; |
dbcf12a6 |
40 | $c->stash->{template} = 'index.tt'; |
41 | } |
42 | |
43 | =head2 default |
44 | |
45 | Standard 404 error page |
46 | |
47 | =cut |
48 | |
49 | sub default :Path { |
50 | my ( $self, $c ) = @_; |
51 | $c->response->body( 'Page not found' ); |
52 | $c->response->status(404); |
53 | } |
54 | |
55 | =head2 end |
56 | |
57 | Attempt to render a view, if needed. |
58 | |
59 | =cut |
60 | |
61 | sub end : ActionClass('RenderView') {} |
62 | |
63 | =head1 AUTHOR |
64 | |
65 | Tara L Andrews |
66 | |
67 | =head1 LICENSE |
68 | |
69 | This library is free software. You can redistribute it and/or modify |
70 | it under the same terms as Perl itself. |
71 | |
72 | =cut |
73 | |
74 | __PACKAGE__->meta->make_immutable; |
75 | |
76 | 1; |