rename TreeOfTexts to less annoying stemmaweb
[scpubgit/stemmatology.git] / stemmaweb / lib / stemmaweb / Controller / Stexaminer.pm
CommitLineData
5c9ecf66 1package stemmaweb::Controller::Stexaminer;
2376359f 2use Moose;
3use namespace::autoclean;
4use File::Temp;
5use JSON;
6use Text::Tradition::Analysis qw/ run_analysis /;
7
8BEGIN { extends 'Catalyst::Controller' }
9
10
11=head1 NAME
12
5c9ecf66 13stemmaweb::Controller::Stexaminer - Simple controller for stemma display
2376359f 14
15=head1 DESCRIPTION
16
17The stemma analysis tool with the pretty colored table.
18
19=head1 METHODS
20
21 GET stexaminer/$textid
22
23Renders the application for the text identified by $textid.
24
25=head2 index
26
27=cut
28
29sub index :Path :Args(1) {
30 my( $self, $c, $textid ) = @_;
31 my $m = $c->model('Directory');
32 my $tradition = $m->tradition( $textid );
33 my $stemma = $tradition->stemma;
34 # TODO Think about caching the stemma in a session
35 $c->stash->{svg} = $stemma->as_svg;
36 $c->stash->{text_title} = $tradition->name;
37 $c->stash->{template} = 'stexaminer.tt';
38 # TODO Run the analysis as AJAX from the loaded page.
39 my $t = run_analysis( $tradition );
40 $c->stash->{variants} = $t->{'variants'};
41 $c->stash->{total} = $t->{'variant_count'};
42 $c->stash->{genealogical} = $t->{'genealogical_count'};
43 $c->stash->{conflict} = $t->{'conflict_count'};
44}
45
46=head2 end
47
48Attempt to render a view, if needed.
49
50=cut
51
52sub end : ActionClass('RenderView') {}
53
54=head1 AUTHOR
55
56Tara L Andrews
57
58=head1 LICENSE
59
60This library is free software. You can redistribute it and/or modify
61it under the same terms as Perl itself.
62
63=cut
64
65__PACKAGE__->meta->make_immutable;
66
671;