/
search.html
89 lines (79 loc) · 3.78 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
85
86
87
88
89
{% extends "page.html" %}
{% block title %}{{ _("Search for a Dataset") }} - {{ super() }}{% endblock %}
{% block breadcrumb_content %}
<li class="active">{{ h.nav_link(_('Search Datasets'), controller='package', action='search', highlight_actions = 'new index') }}</li>
{% endblock %}
{% block primary_content %}
<section class="module">
<div class="module-content">
<form id="dataset-search" class="dataset-search clearfix" method="get" data-module="select-switch" data-module-button="#submit-order-by">
<span class="control-group search-giant">
<input type="text" class="search" name="q" value="{{ c.q }}" autocomplete="off" results="0" placeholder="{{ _('Search...') }}" />
<button type="submit" value="{{ _('Search') }}">Submit</button>
</span>
{{ h.snippet('snippets/sort_by.html', sort=c.sort_by_selected) }}
{% if c.fields -%}
<span>
{%- for k, v in c.fields -%}
<input type="hidden" name="{{ k }}" value="{{ v }}" />
{% endfor -%}
</span>
{%- endif %}
<div id="dataset-search-ext"></div>
</form>
<div class="results">
<strong>
{%- if request.params and c.page.item_count -%}
{{ c.page.item_count }} datasets{{ _(" found for \"{query}\"").format(query=c.q) if c.q }}
{%- elif request.params and c.page.item_count == 0 -%}
{{ _('Sorry no datasets found for "{query}"').format(query=c.q) }}
{%- else -%}
{{ _('All datasets') }}
{%- endif -%}
</strong>
<div class="filter-list">
{% for field in c.fields_grouped %}
<span class="facet">{{ c.facet_titles.get(field) }}:</span>
{% for value in c.fields_grouped[field] %}
<span class="filtered pill">
{%- if c.translated_fields and c.translated_fields.has_key((field,value)) -%}
{{ c.translated_fields[(field,value)] }}
{%- else -%}
{{ value }}
{%- endif %}
<a href="{{ c.remove_field(field, value) }}" class="remove icon-remove icon-white">[remove]</a>
</span>
{% endfor %}
{% endfor %}
</div>
{% if request.params and c.page.item_count == 0 %}
<p class="extra">Try another search term,
browse the datasets below or <a href="{{ h.url_for(controller='package', action='new') }}">{{ _('add your own data') }}</a>.
</p>
{% endif %}
</div>
{% if c.query_error %}
{% trans %}
<p><strong>There was an error while searching.</strong> Please try again.</p>
{% endtrans %}
{% endif %}
{{ h.snippet('snippets/package_list.html', packages=c.page.items) }}
</div>
{{ c.page.pager(q=c.q) }}
</section>
<section class="module module-narrow module-shallow">
<small class="module-content">
You can also access this registry using the {{ h.link_to(_('API'), h.url_for(controller='api', action='get_api', ver=1)) }}
<!--! FIXME the API Docs link should be for the version of ckan being used but the dev version of ckan needs to point to latest so not trivial -->
(see {{ h.link_to(_('API Docs'), 'http://docs.ckan.org/en/latest/api.html') }})
{% if config.get('ckan.dumps_url') -%}
or download a <a href="{{ config.get('ckan.dumps_url') }}">full {{ config.get('ckan.dumps_format', '') }} dump</a>
{%- endif %}.
</small>
</section>
{% endblock %}
{% block secondary_content %}
{{ h.snippet('snippets/facet_list.html', title='Tags', name='tags') }}
{{ h.snippet('snippets/facet_list.html', title='Formats', name='res_format') }}
{{ h.snippet('snippets/facet_list.html', title='Groups', name='groups') }}
{% endblock %}