forked from metacpan/metacpan-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowse.tx
57 lines (55 loc) · 2.68 KB
/
browse.tx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%% cascade base {
%% title => $title || 'Browse ' ~ [$author, $release].merge($directory).join('/'),
%% }
%% override breadcrumbs -> {
<div class="breadcrumbs">
<a href="/release/[% $author %]/[% $release %]/source">[% $author %] / [% $release %]</a>
%% for $directory -> $part {
%% my $link = $directory.slice(0, $~part).join('/')
/ [% if $~part.is_last { $part } else { %]<a href="/release/[% $author %]/[% $release %]/source/[% $link %]">[% $part %]</a>[% } %]
%% }
</div>
%% }
%% override left_nav_content -> {
%% include inc::release_status { maturity => $maturity }
<li class="nav-header">Tools</li>
<li><a data-keyboard-shortcut="g d" href="/release/[% $author %]/[% $release %]"><i class="fa fa-fw fa-info-circle black"></i>Release Info</a></li>
<li><a data-keyboard-shortcut="g a" href="/author/[% $author %]"><i class="fa fa-user fa-fw black"></i>Author</a></li>
<li><a href="[% $source_host %]/source/[% [$author, $release].merge($directory).join('/') %]"><i class="fa fa-file-alt fa-fw black"></i>Raw browser</a></li>
<li class="nav-header">Info</li>
%% my $folder_count = $files.map(-> $f { $f.directory ? 1 : 0 }).sum();
%% my $file_count = $files.size() - $folder_count;
<li>[% pluralize("%d folder(s)", $folder_count) %]</li>
<li>[% pluralize("%d file(s)", $file_count) %]</li>
%% }
%% override content -> {
<div class="content">
<table id="metacpan-file-browse" class="table table-condensed table-striped file-table tablesorter">
<thead>
<tr>
<th class="name">Name</th>
<th class="documentation">Documentation</th>
<th class="size">Size</th>
<th class="mtime">Last Modified</th>
</tr>
</thead>
<tbody>
%% for $files -> $file {
<tr>
<td class="name" sort="[% ( $file.directory == 1 ? "!" : '' ) ~ $file.name %]"><a href="/release/[% $author %]/[% $release %]/source/[% $file.path %]" class="[%
$file.directory ? 'silk-folder'
: $file.mime.match("perl") ? 'silk-page-white-code'
: $file.mime.match("x-c") ? 'silk-page-white-c'
: 'silk-page-white'
%]" title="[% $file.path %]">[% $file.name %]</a></td>
<td class="documentation"><strong><a href="/release/[% $author %]/[% $release %]/view/[% $file.path %]" title="[% $file.path %]" class="ellipsis">[% $file.slop ? $file.documentation ? $file.documentation : $file.name : "" %]</a></strong></td>
<!-- [% $file | dump %] -->
<td class="size" sort="[% $file.directory ? 0 : $file.stat.size %]">[% $file.directory ? '' : format_bytes($file.stat.size) %]</td>
%% my $date = datetime($file.stat.mtime).to_http;
<td class="mtime relatize" nowrap="nowrap" sort="[% $date %]">[% $date %]</td>
</tr>
%% }
</tbody>
</table>
</div>
%% }