-
Notifications
You must be signed in to change notification settings - Fork 2k
/
search.html
95 lines (84 loc) · 3.61 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
90
91
92
93
94
95
{% extends "page.html" %}
{% import 'macros/form.html' as form %}
{% block subtitle %}{{ _("Search for a Dataset") }}{% endblock %}
{% block add_action_content %}
{% if h.check_access('package_create') %}
{% link_for _('Add Dataset'), controller='package', action='new', class_='btn btn-primary', icon='plus-sign-alt' %}
{% endif %}
{% endblock %}
{% block breadcrumb_content %}
<li class="active">{{ h.nav_link(_('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">
<span class="control-group search-giant">
<input type="text" class="search" name="q" value="{{ c.q }}" autocomplete="off" 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>
{{ form.hidden_from_list(fields=c.fields) }}
</span>
{%- endif %}
<div id="dataset-search-ext">{% block dataset_search_ext %}{% endblock %}</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" title="{{ _('Remove') }}"><i class="icon-remove"></i></a>
</span>
{% endfor %}
{% endfor %}
</div>
{% if request.params and c.page.item_count == 0 %}
{% trans %}
<p class="extra">Please try another search.</p>
{% endtrans %}
{% 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">
<div class="module-content">
<small>
You can also access this registry using the {{ h.link_to(_('API'), h.url_for(controller='api', action='get_api', ver=3)) }}
(see {{ h.link_to(_('API Docs'), 'http://docs.ckan.org/en/ckan-{0}/api.html'.format(g.ckan_base_version)) }})
{% if g.dumps_url -%}
or download a <a href="{{ g.dumps_url }}">full {{ g.dumps_format }} dump</a>
{%- endif %}.
</small>
</div>
</section>
{% endblock %}
{% block secondary_content %}
{% for facet in c.facet_titles %}
{{ h.snippet('snippets/facet_list.html', title=c.facet_titles[facet], name=facet) }}
{% endfor %}
{% endblock %}