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=96e4426248ea4d81b9c6aeeceeb85cf8416bc7fa;hp=f6a8db89d391b57e3ddb05a1684ff1e16cfd7523;p=scpubgit%2Fstemmaweb.git use simpler Directory interface --- diff --git a/lib/stemmaweb/Controller/Root.pm b/lib/stemmaweb/Controller/Root.pm index 16075bd..4b4e5e8 100644 --- a/lib/stemmaweb/Controller/Root.pm +++ b/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'); }