Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display the Web of Trust Leaderboard. [Part 1]
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package MetaCPAN::Web::Controller::Trust; | ||
use strict; | ||
use warnings; | ||
use base 'MetaCPAN::Web::Controller'; | ||
|
||
sub index : Path('/trust/leaderboard') { | ||
my ( $self, $c ) = @_; | ||
|
||
my $data = $c->model('API::Trust')->leaderboard( $c->req->page )->recv; | ||
my @leaders = @{ $data->{facets}->{leaderboard}->{terms} }[ 0 .. 99 ]; | ||
$c->stash( | ||
{ | ||
leaders => \@leaders, | ||
took => $data->{took}, | ||
total => $data->{hits}->{total}, | ||
template => 'trust/leaderboard.html', | ||
} | ||
); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<% title = 'Most Trusted Authors' %> | ||
<%- INCLUDE inc/recent-bar.html %> | ||
|
||
<div class="content"> | ||
<table class="table table-condensed table-striped table-releases"> | ||
<thead> | ||
<tr> | ||
<th class="position"></th> | ||
<th class="name pull-left-phone">Author</th> | ||
<th class="date"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% FOREACH leader IN leaders %> | ||
<tr> | ||
<td class="number<% IF loop.index() < 5; " strong"; END %>"><% loop.index() + 1 %></td> | ||
<td class="name"><strong><a href="/author/<% leader.term %>"><% leader.term %></a></strong></td> | ||
<td class="number"><% leader.count %> <% IF leader.count == 1 %>trust <% ELSE %>trusts <% END %></td> | ||
</tr> | ||
<% END %> | ||
</tbody> | ||
</table> | ||
</div> |