/
search.html
73 lines (67 loc) · 2.86 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
{% extends "page.html" %}
{% import 'macros/form.html' as form %}
{% block subtitle %}{{ _("Search for a Dataset") }}{% 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 page_primary_action %}
{% if h.check_access('package_create') %}
<div class="page_primary_action">
{% link_for _('Add Dataset'), controller='package', action='new', class_='btn btn-primary', icon='plus-sign-alt' %}
</div>
{% endif %}
{% endblock %}
{% block form %}
{% set facets = {
'fields': c.fields_grouped,
'search': c.search_facets,
'titles': c.facet_titles,
'translated_fields': c.translated_fields,
'remove_field': c.remove_field }
%}
{% set sorting = [
(_('Relevance'), 'score desc, metadata_modified desc'),
(_('Name Ascending'), 'title_string asc'),
(_('Name Descending'), 'title_string desc'),
(_('Last Modified'), 'metadata_modified desc'),
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ]
%}
{% snippet 'snippets/search_form.html', type='dataset', query=c.q, sorting=sorting, sorting_selected=c.sort_by_selected, count=c.page.item_count, facets=facets, show_empty=request.params, error=c.query_error %}
{% endblock %}
{% block package_search_results_list %}
{{ h.snippet('snippets/package_list.html', packages=c.page.items) }}
{% 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}/api.html'.format(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 %}