{% extends "page.html" %}

{% block subtitle %}{{ _(dataset_type.title()) }}{% endblock %}

{% block breadcrumb_content %}
  <li class="active">{{ h.nav_link(_(dataset_type.title() + 's'), named_route='%s.search' % dataset_type) }}</li>
{% endblock %}

{% block content_action %}
  {% if h.check_access('package_create') %}
    {% snippet 'snippets/add_dataset.html', dataset_type=dataset_type %}
  {% endif %}
{% endblock %}

{% block primary_content %}
  {% snippet "package/snippets/search_results.html",
    heading=h.humanize_entity_type('dataset', dataset_type, 'page title') or _('Datasets'),
    dataset_type=dataset_type,
    fields_grouped=fields_grouped,
    search_facets=search_facets,
    facet_titles=facet_titles,
    translated_fields=translated_fields,
    remove_field=remove_field,
    q=q,
    sort_by_selected=sort_by_selected,
    page=page,
    query_error=query_error,
    fields=fields
  %}

  {% block package_search_results_api %}
    <section class="module">
      <div class="module-content">
        {% block package_search_results_api_inner %}
          <small>
            {% set api_link = h.link_to(_('API'), h.url_for('api.get_api', ver=3)) %}
            {% set api_doc_link = h.link_to(_('API Docs'), 'https://docs.ckan.org/en/{0}/api/'.format(g.ckan_doc_version)) %}
            {% trans %} You can also access this registry using the {{ api_link }} (see {{ api_doc_link}}). {% endtrans %}
          </small>
        {% endblock %}
      </div>
    </section>
  {% endblock %}
{% endblock %}


{% block secondary_content %}
  {% snippet "package/snippets/search_facets.html",
    facet_titles=facet_titles,
    search_facets=search_facets
  %}
{% endblock %}
