{% extends 'base.html' %}
{% load staticfiles %}
{% block content %}
    <table class="table striped hover" id="result_table">
        <thead>
        <tr>
            <th>
                Results for <strong>{{ query }}</strong>
            </th>
        </tr>
        </thead>

        <tbody>

        {% for result in query_sets %}
            <tr>
                <td>

                    <a href='{% url result.3 result.2 %}'>{{ result.0 }} in <strong>{{ result.1 }}</strong></a>
                </td>
            </tr>

        {% empty %}
            <tr>
                <td>
                    <strong>Your search produced no results.</strong>
                </td>
            </tr>
        {% endfor %}


        </tbody>
        <tfoot>
        <tr>
            <td>
                <small>{{ query_sets|length }} results in {{ time }} seconds.</small>
            </td>
        </tr>
        </tfoot>
    </table>
{% endblock %}

{% block scripts %}
    {{ block.super }}
    <script type="text/javascript" src="{% static 'js/jquery.dataTables.min.js' %}"></script>
    <script type="text/javascript">
        $(document).ready(function () {
                    var table = $('#result_table').DataTable(
                            {
                                "dom": 'lfrtp<"left"T>',
                                "deferRender": true
                            });
                }
        );
    </script>
{% endblock scripts %}