Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix issues GH1703 + GH1704
  • Loading branch information
mickeyn committed Jun 9, 2016
1 parent e107bf1 commit 8cbe781
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/MetaCPAN/Web/Controller/Source.pm
Expand Up @@ -3,6 +3,9 @@ package MetaCPAN::Web::Controller::Source;
use Moose;
use namespace::autoclean;

use Importer 'MetaCPAN::Web::Elasticsearch::Adapter' =>
qw/ single_valued_arrayref_to_scalar /;

BEGIN { extends 'MetaCPAN::Web::Controller' }

sub index : Path : Args {
Expand Down Expand Up @@ -37,16 +40,18 @@ sub index : Path : Args {
$c->model('API::Module')->get(@module)->recv,
);
}

if ( $module->{directory} ) {
my $files = $c->model('API::File')->dir(@module)->recv;
$c->res->last_modified( $module->{date} );
$c->stash(
{
template => 'browse.html',
files => [ map { $_->{fields} } @{ $files->{hits}->{hits} } ],
total => $files->{hits}->{total},
took => $files->{took},
files => [
map { single_valued_arrayref_to_scalar( $_->{fields} ) }
@{ $files->{hits}->{hits} }
],
total => $files->{hits}->{total},
took => $files->{took},
author => shift @module,
release => shift @module,
directory => \@module,
Expand Down

0 comments on commit 8cbe781

Please sign in to comment.