From: Tara L Andrews Date: Mon, 10 Oct 2011 13:57:08 +0000 (+0200) Subject: allow division of fetch for table and SVG stemma X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a275e7e66f69a4a9bb26ba1047b67a5fc99ff179;p=scpubgit%2Fstemmatology.git allow division of fetch for table and SVG stemma --- diff --git a/TreeOfTexts/lib/TreeOfTexts/Controller/Root.pm b/TreeOfTexts/lib/TreeOfTexts/Controller/Root.pm index 2cd3a76..e9deda3 100644 --- a/TreeOfTexts/lib/TreeOfTexts/Controller/Root.pm +++ b/TreeOfTexts/lib/TreeOfTexts/Controller/Root.pm @@ -49,6 +49,24 @@ sub view_text :Local { $c->stash->{conflict} = $t->{'conflict_count'}; $c->stash->{template} = 'index.tt'; } + +sub view_table :Local { + my( $self, $c ) = @_; + my $m = $c->model( 'Analysis' ); + my $t = $m->{'data'}->[ $c->request->params->{'textid'} ]; + $c->stash->{variants} = $t->{'variants'}; + $c->stash->{template} = 'table_gadget.tt'; +} + +sub view_svg :Local { + my( $self, $c ) = @_; + my $m = $c->model( 'Analysis' ); + my $t = $m->{'data'}->[ $c->request->params->{'textid'} ]; + $c->stash->{result} = $t->{'svg'}; + $c->forward( "View::SVG" ); +} + + =head2 default Standard 404 error page diff --git a/TreeOfTexts/root/src/table_gadget.tt b/TreeOfTexts/root/src/table_gadget.tt new file mode 100644 index 0000000..201b05d --- /dev/null +++ b/TreeOfTexts/root/src/table_gadget.tt @@ -0,0 +1,36 @@ + + + + + + + + + [% INCLUDE style.tt2 %] + + +
+ +[% FOREACH row IN variants -%] +[% INCLUDE variantrow %] +[% END -%] +
+
+ + + +[% BLOCK variantrow -%] +[% SET rowclass = 'class="genealogical"' IF row.genealogical -%] +[% SET rowclass = 'class="coincidental"' UNLESS row.genealogical -%] + + [% row.id %] +[% FOREACH reading IN row.readings -%] +[% SET cellclass = 'clickable conflict' IF reading.conflict -%] +[% SET cellclass = 'clickable' IF !reading.conflict -%] + [% reading.text %] +[% END -%] +[% FILTER repeat( row.empty ) -%] + +[% END -%] + +[% END -%] \ No newline at end of file