<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>
  {% snippet 'snippets/sort_by.html', sort=c.sort_by_selected %}
  {% if c.fields %}
    <span>
      {% for key, value in c.fields %}
        <input type="hidden" name="{{ key }}" value="{{ value }}" />
      {% endfor %}
    </span>
  {% endif %}
  <div id="dataset-search-ext"></div>
</form>
<div class="results">
  <strong>
    {% snippet 'snippets/search_result_text.html', query=c.q, count=c.page.item_count, type='dataset' %}
  </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>
</div>

{% if c.query_error %}
  <p>
  {% trans %}
    <strong>There was an error while searching.</strong> Please try again.
  {% endtrans %}
  </p>

{% else %}
  {% if c.page.items %}
    {{ h.snippet('snippets/package_list.html', packages=c.page.items, bulk_processing=c.bulk_processing) }}
  {% endif %}
{% endif %}
