forked from metacpan/metacpan-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.tx
68 lines (64 loc) · 2.25 KB
/
search.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
58
59
60
61
62
63
64
65
66
67
68
%% cascade base::search {
%% title => $title || 'Search for "' ~ $search_query ~ '"',
%% }
%% override content -> {
<div class="content search-results">
%% if $authors.total {
<div class="author-results">
<ul class="authors clearfix">
%% for $authors.authors -> $author {
<li>
<a href="/author/[% $author.id %]" title="Author page for [% $author.name %]">
<img src="[% gravatar_image($author, 30) %]">
[% $author.name %] ([% $author.pauseid %])
</a>
</li>
%% }
</ul>
</div>
%% }
%% for $results -> $group {
%% my $first= $group.hits.0;
<div class="module-result">
<h3>
%% include inc::link_to_file { file => $first };
%% if $first.abstract { ' - ' ~ $first.abstract }
%% include inc::river_gauge { distribution => $first.distribution, river => $group.river };
%% include inc::favorite { release => $first, favorites => $release.favorites };
</h3>
%% if $first.description {
<p class="description">[% $first.description.substr(0, 250) ~ '...' %]</p>
%% }
<a class="author" href="/author/[% $first.author | uri %]">[% $first.author %]</a><a href="[% if $first.status == 'latest' { '/dist/' ~ $first.distribution } else { '/release/' ~ $first.author ~ '/' ~ $first.release } %]">/[% $first.release %]</a>
-
<span class="relatize">[% datetime($first.date).to_http %]</span>
%% if !$single_dist {
-
<a href="/search?q=dist:[% $first.distribution %]+[% $search_query %]">Search in distribution</a>
%% }
<!-- [% $first.score %] -->
%% if $group.hits.size() > 1 {
<ul class="inner-results">
%% for $group.hits -> $item {
%% if $~item.is_first { next }
%% if $~item > 3 { last }
<li>
%% include inc::link_to_file { file => $item };
%% if $item.abstract {
- [% $item.abstract %]
%% }
</li>
<!-- [% $item.score %] -->
%% }
%% if $group.total > 4 {
<li>
<a href="/search?q=distribution:[% $first.distribution %]+[% $search_query %]">[% $group.total - 4 %] more result[% if $group.total - 4 > 1 { 's' } %] from [% $first.distribution %] »</a>
</li>
%% }
</ul>
%% }
</div>
%% }
%% include inc::pager
</div>
%% }