Skip to content

Commit a8448e6

Browse files
committed
Closes metacpan#216
1 parent a6a7819 commit a8448e6

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

lib/MetaCPAN/Web/Controller/Release.pm

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,29 @@ sub index : PathPart('release') : Chained('/') : Args {
3030
$out->{myfavorite} = $favorites->{myfavorites}->{ $out->{distribution} };
3131
$out->{favorites} = $favorites->{favorites}->{ $out->{distribution} };
3232

33+
my @root_files = (
34+
sort
35+
map { $_->{fields}->{name} } @{ $root->{hits}->{hits} }
36+
);
37+
38+
my $changes = undef;
39+
foreach my $filename ( @root_files ) {
40+
if ( $filename =~ m{\AChange}i ) {
41+
$changes = $filename;
42+
last;
43+
}
44+
}
45+
3346
$c->stash(
3447
{ template => 'release.html',
3548
release => $out,
3649
author => $author,
50+
changes => $changes,
3751
total => $modules->{hits}->{total},
3852
took => List::Util::max(
3953
$modules->{took}, $root->{took}, $versions->{took}
4054
),
41-
root => [
42-
sort { $a->{name} cmp $b->{name} }
43-
map { $_->{fields} } @{ $root->{hits}->{hits} }
44-
],
55+
root => \@root_files,
4556
versions =>
4657
[ map { $_->{fields} } @{ $versions->{hits}->{hits} } ],
4758
files => [

root/release.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<ul>
99
<li><strong class="relatize"><% release.date.dt_http %></strong></li>
1010
<li><a href="<% release.download_url %>">Download</a> (<% release.stat.size | format_bytes %>)</li>
11+
<% IF changes %>
12+
<li><a href="/source/<% release.author; '/'; release.name; '/'; changes %>"><% changes %></a></li>
13+
<% END %>
1114
<li><a href="<% api %>/source/<% release.author %>/<% release.name %>/">Browse</a></li>
1215
<% PROCESS inc/release-info.html %>
1316
</ul>
@@ -88,8 +91,8 @@
8891

8992
<br><% END %>
9093
<% IF root.size %><strong>Other files</strong>
91-
<% FOREACH file IN root %>
92-
<div><strong><a href="/source/<% release.author; '/'; release.name; '/'; file.name %>"><% file.name %></a></strong></div>
94+
<% FOREACH filename IN root %>
95+
<div><strong><a href="/source/<% release.author; '/'; release.name; '/'; filename %>"><% filename %></a></strong></div>
9396
<% END; END %>
9497

9598
</div>

0 commit comments

Comments
 (0)