-
Notifications
You must be signed in to change notification settings - Fork 2k
/
search.html
117 lines (106 loc) · 4.44 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{% 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">
{% block form %}
<form id="dataset-search" class="dataset-search clearfix" method="get" data-module="select-switch">
{% block search_input %}
<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>
{% endblock %}
{% block package_sortby %}
{{ h.snippet('snippets/sort_by.html', sort=c.sort_by_selected) }}
{% endblock %}
{% block package_search_fields %}
{% if c.fields -%}
<span>
{{ form.hidden_from_list(fields=c.fields) }}
</span>
{%- endif %}
{% endblock %}
<div id="dataset-search-ext">{% block dataset_search_ext %}{% endblock %}</div>
</form>
{% endblock %}
{% block package_search_results %}
<div class="results">
<strong>
{% block package_search_results_text %}
{% snippet 'snippets/search_result_text.html', query=c.q, count=c.page.item_count, type='dataset' %}
{% endblock %}
</strong>
<div class="filter-list">
{% block package_search_results_filter_list %}
{% for field in c.fields_grouped %}
{% set search_facets_items = c.search_facets.get(field)['items'] %}
<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 -%}
{{ h.list_dict_filter(search_facets_items , 'name', 'display_name', value) }}
{%- endif %}
<a href="{{ c.remove_field(field, value) }}" class="remove" title="{{ _('Remove') }}"><i class="icon-remove"></i></a>
</span>
{% endfor %}
{% endfor %}
{% endblock %}
</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 %}
{% block package_search_results_list %}
{{ h.snippet('snippets/package_list.html', packages=c.page.items) }}
{% endblock %}
{% endblock %}
</div>
{% block page_pagination %}
{{ c.page.pager(q=c.q) }}
{% endblock %}
</section>
{% block package_search_results_api %}
<section class="module">
<div class="module-content">
<small>
{% set api_link = h.link_to(_('API'), h.url_for(controller='api', action='get_api', ver=3)) %}
{% set api_doc_link = h.link_to(_('API Docs'), 'http://docs.ckan.org/{0}/{1}/api.html'.format(request.environ.CKAN_LANG, g.ckan_doc_version)) %}
{% if g.dumps_url -%}
{% set dump_link = h.link_to(_('full {format} dump').format(format=g.dumps_format), g.dumps_url) %}
{% trans %}
You can also access this registry using the {{ api_link }} (see {{ api_doc_link }}) or download a {{ dump_link }}.
{% endtrans %}
{% else %}
{% trans %}
You can also access this registry using the {{ api_link }} (see {{ api_doc_link}}).
{% endtrans %}
{%- endif %}
</small>
</div>
</section>
{% endblock %}
{% 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 %}