lacuna nodes need to be marked as such on read
[scpubgit/stemmatology.git] / TreeOfTexts / lib / TreeOfTexts / Controller / Root.pm
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
33     my $file = $c->path_to( 't', 'data', 'florilegium.xml' );
34     my $stemma = $c->path_to( 't', 'data', 'stemma_a.dot' );
35     my( $svg, $variant_data ) = run_analysis( $file, $stemma );
36         $c->stash->{svg} = $svg;
37         $c->stash->{variants} = $variant_data;
38         $c->stash->{template} = 'index.tt'; 
39 }
40
41 =head2 default
42
43 Standard 404 error page
44
45 =cut
46
47 sub default :Path {
48     my ( $self, $c ) = @_;
49     $c->response->body( 'Page not found' );
50     $c->response->status(404);
51 }
52
53 =head2 end
54
55 Attempt to render a view, if needed.
56
57 =cut
58
59 sub end : ActionClass('RenderView') {}
60
61 =head1 AUTHOR
62
63 Tara L Andrews
64
65 =head1 LICENSE
66
67 This library is free software. You can redistribute it and/or modify
68 it under the same terms as Perl itself.
69
70 =cut
71
72 __PACKAGE__->meta->make_immutable;
73
74 1;