{% load i18n filer_admin_tags %}

{% for clipboard in user.filer_clipboards.all %}
    <div class="clipboard hidden">
        <table style="width: 100%; border: 1px solid #DDDDDD;" xmlns="http://www.w3.org/1999/html"
               xmlns="http://www.w3.org/1999/html">
            <thead>
                <tr>
                    <th colspan="3">{% trans "Clipboard" %}</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <td colspan="3">
                        <form action="{% url 'admin:filer-paste_clipboard_to_folder' %}" method="post" style="display: inline;">
                            {% csrf_token %}
                            <input type="hidden" name="folder_id" value="{{ folder.pk|safe }}">
                            <input type="hidden" name="clipboard_id" value="{{ clipboard.pk|safe }}">
                            <input type="hidden" name="redirect_to" value="{{ current_url }}">
                            {% filer_admin_context_hidden_formfields %}
                            <button class="pastelink" type="submit" {% if folder.is_root or not permissions.has_add_children_permission %} disabled="disabled" style="color: gray;"{% endif %} title="{% trans 'Paste all items here' %}"><span>&lArr;</span>&nbsp;Paste</button>
                        </form>
                        <form action="{% url 'admin:filer-discard_clipboard' %}" method="post" style="display: inline;">{% csrf_token %}
                            <input type="hidden" name="clipboard_id" value="{{ clipboard.pk|safe }}">
                            <input type="hidden" name="redirect_to" value="{{ current_url }}">
                            {% filer_admin_context_hidden_formfields %}
                            <button class="deletelink" type="submit" title="{% trans 'Move all clipboard files to' %} &#39;{% trans 'Unsorted Uploads' %}&#39; {% trans 'folder' %}"><span>{% trans "Empty Clipboard" %}</span></button>
                        </form>
                        {% comment %}
                        <form action="{% url 'admin:filer-delete_clipboard' %}" method="post" style="display: inline;">{% csrf_token %}
                            <input type="hidden" name="clipboard_id" value="{{ clipboard.pk|safe }}">
                            <input type="hidden" name="redirect_to" value="{{ current_url }}">
                            {% if is_popup %}
                                <input type="hidden" name="_popup" value="1">
                            {% endif %}
                            <button class="deletelink" type="submit" title="{% trans 'Delete all files in the clipboard' %}"><span>{% trans "delete files" %}</span></button>
                        </form>
                        {% endcomment %}
                    </td>
                </tr>
            </tfoot>
            <tbody id="fileInputQueue" class="fileUploadQueue">
                {% if clipboard.files.count %}
                    {% with clipboard.files.all as items %}
                        {% include "admin/filer/tools/clipboard/clipboard_item_rows.html" %}
                    {% endwith %}
                {% else %}
                    <tr class="noItemsRow">
                        <td colspan="3" style="color: gray;text-align: center; height: 48px; vertical-align: middle;">{% trans "the clipboard is empty" %}</td>
                    </tr>
                {% endif %}
            </tbody>
        </table>
    </div>
{% endfor %}
