{% extends "group/read_base.html" %}
{% set dataset_type = h.default_package_type() %}

{% block primary_content_inner %}
  {% block groups_search_form %}
    {% set facets = {
      'fields': fields_grouped,
      'search': search_facets,
      'titles': facet_titles,
      'translated_fields': translated_fields,
      'remove_field': 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')
      ]
    %}
    {% snippet 'snippets/search_form.html', form_id='group-datasets-search-form', type=dataset_type, query=q, sorting=sorting, sorting_selected=sort_by_selected, count=page.item_count, facets=facets, placeholder=h.humanize_entity_type('package', dataset_type, 'search placeholder') or _('Search datasets...'), show_empty=request.args, fields=fields %}
  {% endblock %}
  {% block packages_list %}
    {% if page.items %}
      {% snippet 'snippets/package_list.html', packages=page.items %}
    {% endif %}
  {% endblock %}
  {% block page_pagination %}
    {{ page.pager(q=q) }}
  {% endblock %}
{% endblock %}

{% block secondary_content %}
  {{ super() }}
  <div class="filters">
    <div>
      {% for facet in facet_titles %}
        {% snippet 'snippets/facet_list.html', title=facet_titles[facet], name=facet, extras={'id':group_dict.id}, search_facets=search_facets %}
      {% endfor %}
    </div>
    <a class="close no-text hide-filters"><i class="fa fa-times-circle"></i><span class="text">close</span></a>
  </div>
{% endblock %}
