{% extends "telemeta/base.html" %}
{% load telemeta_utils %}
{% load i18n %}

{% block head_title %}{% trans "Search Results" %} - {{ block.super }}{% endblock %}

{% block title %}
 <img src="{% url telemeta-images "search_red.png" %}" alt="search-results" style="vertical-align:middle" /> {% trans "Search Results" %}
{% endblock %}

{% block content %}
{% if criteria %}
<ul>
  {% if criteria.pattern %}
    <li><b>{% trans "Search pattern" %}:</b> {{criteria.pattern}}</li>
  {% endif %}
  {% if criteria.location %}
    <li><b>{% field_label "Location" %}:</b> {{criteria.location}}</li>
  {% endif %}
  {% if criteria.ethnic_group %}
    <li><b>{% field_label "EthnicGroup" %}:</b> {{criteria.ethnic_group}}</li>
  {% endif %}
  {% if criteria.creator %}
    <li><b>{% field_label "MediaCollection" "creator" %}:</b> {{criteria.creator}}</li>
  {% endif %}
  {% if criteria.collector %}
    <li><b>{% field_label "MediaCollection" "collector" %}:</b> {{criteria.collector}}</li>
  {% endif %}
  {% if criteria.title %}
    <li><b>{% trans "Title" %}:</b> {{criteria.title}}</li>
  {% endif %}
  {% if criteria.rec_year_from %}
    <li><b>{% trans "Year of recording" %}:</b> {{criteria.rec_year_from}}
     {% ifnotequal criteria.rec_year_to criteria.rec_year_from %}
     {% trans "to" %} {{criteria.rec_year_to}}
     {% endifnotequal %}
    </li>
  {% endif %}
  {% if criteria.pub_year_from %}
    <li><b>{% trans "Year of publication" %}:</b> {{criteria.pub_year_from}}
     {% ifnotequal criteria.pub_year_to criteria.pub_year_from %}
     {% trans "to" %} {{criteria.pub_year_to}}
     {% endifnotequal %}
    </li>
  {% endif %}
</ul>
{% endif %}

{% ifequal type 'items' %}

  <p><a href="{% url telemeta-search-collections %}?{{criteria|build_query_string}}">Collections ({{collections_num}})</a> | <b>Items ({{items_num}})</b></p>

  {% with object_list as items %}
   <div class="fullpage">
      {% include "telemeta/inc/mediaitem_list.html" %}
   </div>
  {% endwith %}    

{% else %}

  <p><b>Collections ({{collections_num}})</b> | <a href="{% url telemeta-search-items %}?{{criteria|build_query_string}}">Items ({{items_num}})</a>
  </p>

  {% with object_list as collections %}
   <div class="fullpage">
      {% include "telemeta/inc/collection_list.html" %}
   </div>
  {% endwith %}

{% endifequal %}

{% endblock %}
