{% extends "base_generic.html" %}

{% load staticfiles %}

{% block title %}{{ title }}{% endblock %}

{% block heading %}{{ heading }}{% endblock %}

{% block content %}

<!--
  <div class="row">
    <div class="large-12 columns">
      {% if list_label %}
      <h3>{{list_label}}</h3>
      {% elif list_id %}
      <h3>List '{{list_id}}' of entities in collection '{{coll_id}}'</h3>
      {% else %}
      <h3>List of entities in collection '{{coll_id}}'</h3>
      {% endif %}
    </div>
  </div>
-->

  <div class="row">
    <div class="small-12 columns">
      <form method="POST" action="#">
        {% csrf_token %}

        <!-- - - - - -  search and list view selection - - - - - -->
        <div class="row">
          <!-- Search term entry -->
          <div class="small-12 medium-4 columns">
            <div class="view-value-row row">
              <div class="view-label small-12 medium-3 columns">
                <span>Search</span>
              </div>
              <div class="view-value small-12 medium-9 columns end">
                <input type="text" name="search_for" value="{{search_for}}" />
              </div>
            </div>
          </div>
          <!-- List view entry -->
          {% with field=list_choices %}
          <div class="small-12 medium-4 columns">
            <div class="view-value-row row">
              <div class="view-label small-12 medium-3 columns">
                <span>List</span>
              </div>
              {% include field.field_render_edit %}
            </div>
          </div>
          {% endwith %}
          <!-- View types and refresh buttons -->
          <div class="small-12 medium-4 columns text-right">
            <div class="view-value-row row">
              <div class="view-value small-12 columns">
                {% if url_type_id %}
                <input type="submit" name="list_type" value="List '{{url_type_id}}'" 
                       title="List entities of type {{url_type_id}}" />
                {% endif %}
                <input type="submit" name="list_all" value="List" 
                       title="List entities of all types" />
                <span class="checkbox" 
                      title="If checked, list entries inherited from other collections; otherwise, list only entities defined inthe current collection.">
                  Scope all
                  {% if scope == "all" %}
                  <input type="checkbox" name="list_scope_all" value="list_scope_all" checked="checked" />
                  {% else %}
                  <input type="checkbox" name="list_scope_all" value="list_scope_all" />
                  {% endif %}
                </span>               
                <!--
                <input type="submit" name="view" value="View" 
                       title="View entities from current collection" />
                <input type="submit" name="view_all" value="View all" 
                       title="View collection and site-wide entities" />
                {% if url_type_id %}
                <span class="checkbox">
                  <input type="checkbox" name="view_all_types" value="view_all_types" 
                         title="List all types" />
                  All types
                </span>               
                {% endif %}
                -->
                <!--
                <button type="submit" name="search" value="Search">
                <img src="{% static 'images/icons/search_32.png' %}"/>
                </button>
                -->
              </div>
            </div>
          </div>
        </div>

        <!-- - - - - -  table data - - - - - -->
        <div class="table row">
          <div class="small-12 columns">
            {% include List_rows.field_render_view with field=List_rows %}
          </div>
        </div>
        <!-- - - - - -  table ends - - - - - -->

        <div class="row">
          <div class="form-buttons small-12 medium-6 columns">
            <input type="submit" name="new"       value="New"    title="Create new entity."/>
            <input type="submit" name="copy"      value="Copy"   title="Copy selected entity."/>
            <input type="submit" name="edit"      value="Edit"   title="Edit selected entity."/>
            <input type="submit" name="delete"    value="Delete" title="Delete selected entity."/>
          </div>
          <div class="form-buttons small-12 medium-6 columns text-right medium-up-text-right">
            <input type="submit" name="default_view" value="Set default" 
                   title="Select this list as the default view for collection '{{coll_id}}'."
                   {{default_view_enable}} />
            <input type="submit" name="customize"    value="Customize"
                   title="Open 'Customize' view for collection '{{coll_id}}'."
                   {{customize_view_enable}} />
          </div>
        </div>

        <div class="row">
          <div class="small-12 medium-6 columns">
            <input type="submit" name="close"           value="Close" />
          </div>
          <!-- "get the data" button -->
          <div class="small-12 medium-6 columns text-right medium-up-text-right">
            <div class="row view-value-row">
              <div class="small-12 columns">
                <!-- Cf. https://github.com/BetaNYC/getDataButton -->
                <a href="{{entity_list_ref}}" title="Retrieve underlying data as JSON-LD">JSON-LD</a>
                <a href="{{entity_list_ref_json}}"  title="Retrieve underlying JSON data">
                  <img src="{% static 'images/get_the_data_88x31.png' %}" alt="get_the_data">
                </a>
              </div>
            </div>
          </div>
        </div>

        <input type="hidden" name="continuation_url"    value="{{continuation_url}}"/>
      </form>
    </div>
  </div>


{% endblock %}
