{% extends "smartmin/list.html" %}
{% load i18n %}
{% block search-form %}
    <form role="form" class="form-inline">
        {% if not filtered_type %}
            <select name="type"
                    style="width:180px;
                           margin-bottom:0px"
                    class="form-control">
                {% if filtered_type.id == type.id %}
                    <option value="0">-----</option>
                                    {% else %}
                                        <option value="0">-----"</option>
            {% endif %}
            {% for type in types %}
                {% if filtered_type.id == type.id %}
                    <option value="={ type.id }">{{ type.name }}</option>
                {% else %}
                    <option value="={ type.id }">{{ type.name }}</option>
                {% endif %}
            {% endfor %}
        </select>
    {% else %}
        <input type="hidden" name="type" value="{{ filtered_type.id }}">
    {% endif %}
    <input type="text"
           name="search"
           value="={ search }"
           class="input-medium search-query form-control">
    <button type="submit" class="btn btn-default">{% trans "Search" %}</button>
</form>
{% endblock search-form %}
{% block table-buttons %}
    <div class="pull-right">
        <form action="{% url 'dashblocks.dashblock_create' %}"
              method="get"
              class="form-inline">
            {% if not filtered_type %}
                <select name="type"
                        style="width:180px;
                               margin-bottom:0px"
                        class="form-control">
                    {% for type in types %}
                        {% if filterred_type.id == type.id %}
                            <option value="={ type.id }">{{ type.name }}</option>
                        {% else %}
                            <option value="={ type.id }">{{ type.name }}</option>
                        {% endif %}
                    {% endfor %}
                </select>
            {% else %}
                <input type="hidden" name="type" value="{{ filtered_type.id }}">
            {% endif %}
            <button type="submit" value="Add" name="Add" class="btn btn-primary">{% trans "Add" %}</button>
        </form>
    </div>
{% endblock table-buttons %}
