From: Tara L Andrews Date: Sat, 21 Jan 2012 23:44:14 +0000 (+0100) Subject: use simpler Directory interface X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=80dad2e38963513cfaa1dd436519732b2fba6744;p=scpubgit%2Fstemmatology.git use simpler Directory interface --- diff --git a/stemmaweb/lib/stemmaweb/Controller/Root.pm b/stemmaweb/lib/stemmaweb/Controller/Root.pm index 16075bd..4b4e5e8 100644 --- a/stemmaweb/lib/stemmaweb/Controller/Root.pm +++ b/stemmaweb/lib/stemmaweb/Controller/Root.pm @@ -50,11 +50,11 @@ sub directory :Local :Args(0) { # TODO not used yet, will load user texts later my $user = $c->request->param( 'user' ) || 'ALL'; my @textlist; - foreach my $id ( $m->tradition_ids ) { - my $t = $m->info( $id ); - push( @textlist, $t ); - } - + $m->scan( sub { + push( @textlist, { + 'id' => $m->object_to_id( @_ ), + 'name' => $_[0]->name } ) + } ); $c->stash->{texts} = \@textlist; $c->stash->{template} = 'directory.tt'; } @@ -128,7 +128,9 @@ sub stemma :Local :Args(1) { $m->store( $tradition ); } - $c->stash->{'result'} = $tradition->stemma->as_svg; + $c->stash->{'result'} = $tradition->stemma + ? $tradition->stemma->as_svg + : ''; $c->forward('View::SVG'); }