Skip to content

Commit

Permalink
Add author links to author handler response
Browse files Browse the repository at this point in the history
This will allow us:
1. Serve the links as extra info from the API as well as the WEB.
2. Not concatenate those links using code within the WEB templates.
3. Reuse the links in templates.
  • Loading branch information
mickeyn committed Jul 11, 2016
1 parent 4b9dc42 commit d30c4ce
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/MetaCPAN/Server/Controller/Author.pm
Expand Up @@ -35,6 +35,19 @@ sub get : Path('') : Args(1) {
$st->{release_count}
= $c->model('CPAN::Release')
->aggregate_status_by_author( $st->{pauseid} );

my ( $id_2, $id_1 ) = $id =~ /^((\w)\w)/;
$st->{links} = {
cpan_directory => "http://cpan.org/authors/id/$id_1/$id_2/$id",
backpan_directory =>
"https://cpan.metacpan.org/authors/id/$id_1/$id_2/$id",
cpants => "http://cpants.cpanauthors.org/author/$id",
cpantesters_reports =>
"http://cpantesters.org/author/$id_1/$id.html",
cpantesters_matrix => "http://matrix.cpantesters.org/?author=$id",
metacpan_explorer =>
"https://explorer.metacpan.org/?url=/author/$id",
};
}
$c->stash($st)
|| $c->detach( '/not_found',
Expand Down

0 comments on commit d30c4ce

Please sign in to comment.