diff --git a/lib/MetaCPAN/Web/Controller/Release.pm b/lib/MetaCPAN/Web/Controller/Release.pm index ee86967f62..22f4cd9b15 100644 --- a/lib/MetaCPAN/Web/Controller/Release.pm +++ b/lib/MetaCPAN/Web/Controller/Release.pm @@ -22,12 +22,14 @@ sub by_distribution : Chained('root') PathPart('') Args(1) { } sub index : Chained('/') PathPart('release') CaptureArgs(1) { - my ( $self, $c, $dist ) = @_; - $c->stash( $c->model('API::Favorite')->find_plussers($dist)->get ); + my ( $self, $c, $distribution ) = @_; + $c->stash( distribution => $distribution ); } sub plusser_display : Chained('index') PathPart('plussers') Args(0) { my ( $self, $c ) = @_; + my $dist = $c->stash->{distribution}; + $c->stash( $c->model('API::Favorite')->find_plussers($dist)->get ); $c->stash( { template => 'plussers.html' } ); } @@ -48,6 +50,15 @@ sub by_author_and_release : Chained('root') PathPart('') Args(2) { $c->forward('view'); } +sub source : Chained('index') PathPart('source') Args { + my ( $self, $c, @path ) = @_; + my $dist = $c->stash->{distribution}; + my $release = $c->model('API::Release')->find($dist)->get->{release} + or $c->detach('/not_found'); + $c->forward( '/source/index', + [ $release->{author}, $release->{name}, @path ] ); +} + sub view : Private { my ( $self, $c ) = @_;