blob: 24b740dc4c4b5801cabf35c9536bf3feac9bd857 (
plain)
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
|
package packages
import "strconv"
templ search(query string, packages []searchResults) {
<div class="container mb-5">
<div class="row">
<div class="col-12">
<h1 class="first-header">
Search Results <small>{ "for " + query }</small>
<a title="Atom feed" href={ templ.URL("/packages/search.atom?q=" + query) } class="kk-feed-icon">
<span class="fa fa-fw fa-rss-square"></span>
</a>
</h1>
if len(packages) > 0 {
<div class="panel panel-default">
<div class="panel-heading">
Results 1—{ strconv.Itoa(len(packages)) } of { strconv.Itoa(len(packages)) }
</div>
<div class="list-group">
for _, pkg := range packages {
<a class="list-group-item list-group-item-action" href={ templ.URL("/packages/" + pkg.Category+"/"+pkg.Name) }>
<h3 class="kk-search-result-header"><span class="text-muted">{ pkg.Category }/</span>{ pkg.Name }</h3>
{ pkg.Description }
</a>
}
</div>
// TODO paging
// <div class="panel-footer">
// <div class="btn-group" role="group" aria-label="Result navigation">
// <%= link_to '< Prev', search_packages_path(q: params[:q], o: [@offset - PackageRepository.default_search_size, 0].max), class: 'btn btn-default' + (@offset > 0 ? '' : ' disabled') %>
// <%= link_to 'Next >', search_packages_path(q: params[:q], o: @offset + PackageRepository.default_search_size), class: 'btn btn-default ' + ((@offset + PackageRepository.default_search_size) > @packages.total ? 'disabled' : '') %>
// </div>
// </div>
</div>
// TODO in head: alternate_feed_link(search_packages_url(format: :atom, params: request.query_parameters), t(:atom_feed))
} else {
<div class="jumbotron">
<h2 class="site-welcome stick-top">Nothing found. :( Try again?</h2>
<form action="/packages/search" method="get">
<div class="typeahead__container">
<div class="typeahead__field">
<span class="typeahead__query">
<input id="q" name="q" type="search" autocomplete="off" placeholder="Find Packages" aria-label="Find Packages" autofocus/>
</span>
<span class="typeahead__button">
<button type="submit" title="Find" aria-label="Find">
<span class="typeahead__search-icon"></span><span class="sr-only">Find</span>
</button>
</span>
</div>
</div>
</form>
</div>
<script src="/assets/index.js"></script>
}
</div>
</div>
</div>
}
|