{% extends "admin/base_site.html" %}

<!-- LOADING -->
{% load i18n %}

<!-- BREADCRUMBS -->
{% block breadcrumbs %}
    <div id="breadcrumbs">
        <a href="../../">{% trans "Home" %}</a> &rsaquo;
        <a href="../">{{ app_label|capfirst }}</a> &rsaquo;
        <a href="./">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
        {% trans 'Export selection as CSV' %}
    </div>
{% endblock %}

<!-- CONTENT -->
{% block content %}
    <script type="text/javascript" charset="utf-8">
        (function($) {
            $(document).ready(function() {
                $("input").attr("autocomplete", "off");
                $('#select_all').click(function(){
                    $("._fields").attr('checked', $(this).attr('checked'));
                });
            });
        })(django.jQuery);
    </script>
    <div class="container-grid csv-export-confirmation">
        <form action="" method="post">{% csrf_token %}
            <fieldset class="module">
                <h2>{% blocktrans %}Export following fields:{% endblocktrans %}</h2>
                <div class="row">
                    <ul class="checkboxlist">
                        <li><label for="select_all"><input type="checkbox" name="select_all" value="" id="select_all" /> {% blocktrans %}Select all{% endblocktrans %}</label></li>
                    </ul>
                </div>
                <div class="row">
                    <ul class="checkboxlist">
                        {% for item in fields %}
                            <li>
                                <label for="id_{{ item.0 }}"><input type="checkbox" class="_fields" name="_fields" value="{{ item.0 }}" id="id_{{ item.0 }}"{% if item.0 in list_display %} checked="checked" {% endif %} /> {{ item.1 }}</label>
                            </li>
                        {% endfor %}
                    </ul>
                </div>
            </fieldset>
            <div class="module footer">
                {% for obj in queryset %}
                    <input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk }}" />
                {% endfor %}
                <input type="hidden" name="action" value="csv_export_selected" />
                <input type="hidden" name="post" value="yes" />
                <ul class="submit-row" {% if is_popup %}style="overflow: auto;"{% endif %}>
                    <li class="left cancel-button-container"><a href="../" class="cancel-link">{% trans "Back" %}</a></li>
                    <li class="submit-button-container"><input type="submit" value="{% trans "Export" %}" class="default" /></li>
                </ul>
            </div>
        </form>
    </div>
{% endblock %}