forked from metacpan/metacpan-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.html
84 lines (82 loc) · 3.74 KB
/
search.html
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<%- query = req.param('q').join(' '); title = 'Search for "' _ query _ '"' %>
<div class="search-bar">
<!--<ul class="search-type">
<a href="/search?q="><li class="icon icon-module">Modules</li></a>
<a href="/search?q=author:<% query %>"><li class="icon icon-user">Authors</li></a>
<li class="icon icon-dist">Distributions</li>
<li class="icon icon-server">Mirrors</li>
</ul>
<hr>-->
<strong>Tags</strong>
<div class="search-tag">
<ul><!--
<li><a style="background-color: <% "stable".to_color %>">8x stable <span>x</span></a></li>
<li><a style="background-color: <% "moose".to_color %>">3x moose<span>x</span></a></li>
<li><a style="background-color: <% "deprecated".to_color %>">2x deprecated<span>x</span></a></li>
-->
<li><i>none</i></li>
</ul>
</div>
<!--<a href="">more ...</a>-->
<hr>
<strong>Index</strong>
<ul>
<a href=""><li>Latest</li></a>
<a href=""><li>CPAN</li></a>
<a href=""><li>BackPAN</li></a>
</ul>
</div>
<div class="search-results">
<% IF authors.total %>
<div id="author-results">
<ul class="authors">
<% FOREACH author IN authors.results %>
<li>
<a href = "/author/<% author.id %>"
title = "Author page for <% author.name | html %>"
>
<% IF author.gravatar_url %>
<img src="<% author.gravatar_url %>" class="author-img">
<% END %>
<% author.name | html %> (<% author.pauseid %>)
</a>
</li>
<% END %>
</ul>
</div>
<% END %>
<% FOREACH group IN results; item = group.0 %>
<big><strong>
<% IF item.documentation -%>
<a href="/module/<% IF item.status == 'latest'; item.documentation; ELSE; [item.author, item.release, item.path].join("/"); END %>"><% item.documentation %></a>
<% ELSE -%>
<a href="/source/<% [item.author, item.release, item.path].join("/") %>"><% item.path %></a>
<% END -%>
<% IF item.abstract; ' - '; item.abstract; END %>
</strong></big><% INCLUDE inc/favorite.html module = item %><br>
<% IF item.description %><p class="description"><% item.description.chunk(250).0 _ '...' %></p>
<% END %>
<a href="/author/<% item.author %>"><% item.author %></a><a href="/release/<% IF item.status == 'latest'; item.distribution; ELSE; item.author; '/'; item.release; END %>">/<% item.release %></a>
<%- IF item.rating.count > 0 %>
<div class="rating-<% (item.rating.mean * 2).fmt('%.0f') / 2 * 10 %>"></div>
(<a href="http://cpanratings.perl.org/dist/<% item.distribution %>"><% item.rating.count %> review<% IF item.rating.count > 1; 's'; END %></a>)
<%- END %> -
<span class="relatize"><% item.date.dt_http %></span> -
<a href="/search?q=distribution:<% item.distribution %>+<% query %>">Search in distribution</a>
<!-- <% item.score %> -->
<br>
<% IF group.size > 1 %>
<ul class="search-group">
<% FOREACH item IN group; IF loop.first; NEXT; END; IF loop.index > 3; LAST; END %><li><% IF item.documentation -%>
<a href="/module/<% IF item.status == 'latest'; item.documentation; ELSE; [item.author, item.release, item.path].join("/"); END %>"><% item.documentation %></a>
<% ELSE -%>
<a href="/source/<% [item.author, item.release, item.path].join("/") %>"><% item.path %></a>
<% END -%> <% IF item.abstract; ' - '; item.abstract; END %></li><!-- <% item.score %> --><% END %>
<% IF group.size > 4 %><li><a href="/search?q=distribution:<% item.distribution %>+<% query %>"><% group.size - 4 %> more result<% IF group.size - 4 > 1; 's'; END %> from <% item.distribution %> »</a></li><% END %>
</ul>
<% END %>
<br>
<% END %>
<% INCLUDE inc/pager.html size = 20 %>
</div>
<pre>