{% load static i18n %}
{% templatetag openblock %} for (var i=0, file; file=o.files[i]; i++) { {% templatetag closeblock %}

    <tr class="template-download fade">

        {% block JS_DOWNLOAD_TEMPLATE_PREVIEW %}
            {% templatetag openblock %} if (file.thumbnailUrl) { {% templatetag closeblock %}
                <td>
                    <span class="preview" data-pk="{% templatetag openblock %}=file.pk{% templatetag closeblock %}">
                            <a href="{% templatetag openblock %}=file.url{% templatetag closeblock %}"
                             title="{% templatetag openblock %}=file.name{% templatetag closeblock %}"
                             data-gallery>
                                <img src="{% templatetag openblock %}=file.thumbnailUrl{% templatetag closeblock %}">
                            </a>
                    </span>
                </td>
            {% templatetag openblock %} } {% templatetag closeblock %}
        {% endblock %}

        {% block JS_DOWNLOAD_TEMPLATE_DOWNLOAD %}
            <td>
                {% block JS_DOWNLOAD_TEMPLATE_NAME %}
                    <p class="name">
                        {% templatetag openblock %} if (file.url) { {% templatetag closeblock %}
                            <a href="{% templatetag openblock %}=file.url{% templatetag closeblock %}"
                             download="{% templatetag openblock %}=file.name{% templatetag closeblock %}"
                             {% templatetag openblock %}=file.thumbnailUrl?'data-gallery':''{% templatetag closeblock %}>
                             {% templatetag openblock %}=file.name{% templatetag closeblock %}
                            </a>
                        {% templatetag openblock %} } else { {% templatetag closeblock %}
                            <span>{% templatetag openblock %}=file.name{% templatetag closeblock %}</span>
                        {% templatetag openblock %} } {% templatetag closeblock %}
                    </p>
                {% endblock %}

                {% block JS_DOWNLOAD_TEMPLATE_ERROR %}
                    {% templatetag openblock %} if (file.error) { {% templatetag closeblock %}
                        <div><span class="label label-danger">Error</span> {% templatetag openblock %}=file.error{% templatetag closeblock %}</div>
                    {% templatetag openblock %} } {% templatetag closeblock %}
                {% endblock %}
            </td>
        {% endblock %}

        {% templatetag openblock %} if (!file.error) { {% templatetag closeblock %}

            {% block JS_DOWNLOAD_TEMPLATE_FSIZE %}
                <td>
                    <span class="size">{% templatetag openblock %}=o.formatFileSize(Number(file.size)){% templatetag closeblock %}</span>
                </td>
            {% endblock %}
        {% templatetag openblock %} } {% templatetag closeblock %}

        {% block JS_DOWNLOAD_TEMPLATE_DELETE %}
            {% if not uploader_disabled %}
                {% templatetag openblock %} if (!file.error) { {% templatetag closeblock %}
                    <td>
                            {% if not disable_server_side_crop %}
                                {% templatetag openblock %} if (file.cropUrl) { {% templatetag closeblock %}
                                    <a type="button"
                                            class="btn btn-info btn-control edit"
                                            data-toggle="modal"
                                            data-action="{% templatetag openblock %}=file.cropUrl{% templatetag closeblock %}"
                                    >
                                        <i class="si si-crop-rotate"></i>
                                        <span>{% trans "Edit" %}</span>
                                    </a>
                                {% templatetag openblock %} } {% templatetag closeblock %}
                            {% endif %}
                        <a type="button" class="btn btn-danger delete fileinput-button input {% if uploader_disabled %} hidden disabled {% endif %}"
                                href="javascript(void(0))">
                            <i class="si-regular si-trash-can"></i>
                            <span>{% trans "Delete" %}</span>
                        </a>
                        {% if upload_url %}
                            <input type="checkbox" value="1" class="toggle fileinput-button input {% if uploader_disabled %} hidden disabled {% endif %}">
                        {% endif %}
                    </td>
                {% templatetag openblock %} } {% templatetag closeblock %}
            {% endif %}
        {% endblock %}
    </tr>
{% templatetag openblock %} } {% templatetag closeblock %}
