diff --git a/lib/PGXN/Site/Templates.pm b/lib/PGXN/Site/Templates.pm index d800360..b16f4e9 100644 --- a/lib/PGXN/Site/Templates.pm +++ b/lib/PGXN/Site/Templates.pm @@ -566,9 +566,9 @@ template distribution => sub { $dist->user; } }; li { - class is 'sub'; + class is 'sub here'; a { - href is $req->uri; + href is $req->uri->path; title is $args->{dist_name}; $args->{dist_name}; } @@ -611,8 +611,9 @@ template document => sub { }; li { class is 'sub here'; + $title; a { - href is $req->uri; + href is $req->uri->path; title is $title; $title; } diff --git a/lib/PGXN/Site/ui/css/layout.css b/lib/PGXN/Site/ui/css/layout.css index 5ccc02c..fa5a440 100755 --- a/lib/PGXN/Site/ui/css/layout.css +++ b/lib/PGXN/Site/ui/css/layout.css @@ -163,7 +163,7 @@ } #crumb li.sub:before { - content:"➤"; + content:"❯"; } #loading { diff --git a/t/router.t b/t/router.t index 4155749..0c100b6 100644 --- a/t/router.t +++ b/t/router.t @@ -128,7 +128,7 @@ test_psgi $app => sub { 'The body should have the invalid in param error'; }; -# Test /dist/ +# Test /dist/$dist and /dist/$dist/$version test_psgi $app => sub { my $cb = shift; @@ -143,8 +143,46 @@ test_psgi $app => sub { my $title = $uri =~ /0/ ? 'pair 0.1.1' : 'pair'; like $res->content, qr{

\Q$title

}, "The body should have the h1 $title"; + } + +}; +# Test /dist/$dist/$path and /dist/$dist/$version/$path/ +test_psgi $app => sub { + my $cb = shift; + + my $uri = '/dist/pair/doc/pair.html'; + ok my $res = $cb->(GET $uri), "Fetch $uri"; + ok $res->is_success, 'Should be a success'; + like $res->content, qr{pair}, + "The body should have the distribution link"; + like $res->content, qr{pair}, + "The body should have the doc link"; + + $uri = '/dist/pair/0.1.1/doc/pair.html'; + ok $res = $cb->(GET $uri), "Fetch $uri"; + ok $res->is_success, 'Should be a success'; + like $res->content, qr{\Qpair 0.1.1}, + "The body should have the distribution link"; + like $res->content, qr{\Qpair}, + "The body should have the doc link"; + + # Make sure we get 404 for nonexistent doc. + for my $version ('', '/0.1.1') { + my $uri = "/dist/pair$version/doc/nonexistent.html"; + ok my $res = $cb->(GET $uri), "Fetch $uri"; + ok !$res->is_success, 'Should not be a success'; + is $res->code, 404, 'Should get 404 response'; + like $res->content, qr/Resource not found\./, + 'The body should have the error'; } + # Make sure we get 404 for nonexistent dist. + $uri = '/dist/nonesuch/doc/nonesuch.html'; + ok $res = $cb->(GET $uri), "Fetch $uri"; + ok !$res->is_success, 'Should not be a success'; + is $res->code, 404, 'Should get 404 response'; + like $res->content, qr/Resource not found\./, + 'The body should have the error'; };