{% extends 'xprez/admin/contents/base.html' %}
{% block options_class %}hidden{% endblock %}

{% block content %}

    {% block dropzone %}
        <div class="js-dropzone js-dropzone-{{ content.pk }} xprez-gallery__dropzone" data-content_pk="{{ content.pk }}" data-uploadurl="{% block upload_url %}{% url 'xprez:downloadcontent_ajax_upload_item' content.pk %}{% endblock %}">
            Drop files here or click to choose files from disk<br>
        </div>
    {% endblock %}

    <div class="xprez-form-table xprez-title-form-table">
        {% include 'xprez/admin/form/row.html' with field=content.admin_form.title %}
    </div>

    <div class="js-item-container" data-content_pk="{{ content.pk }}">
        {% for item in content.attachments.all %}
            {% include content.admin_formset_item_template_name with number=forloop.counter0 %}
        {% endfor %}
    </div>
{% endblock %}

{% block errors %}
    {{ block.super }}
    {% if content.formset.total_error_count > 0 %}
        {{ content.formset.errors }}
    {% endif %}
{% endblock %}

{% block hidden_form %}
    {# {{ content.admin_form.visible }} #}
    {# {{ content.admin_form.position }} #}
    {{ block.super }}
    <div class="js-item-formset">
        {{ content.formset }}
    </div>
{% endblock %}

{% block js %}
    <script>
        $(function () {
            var $container = $('.js-content-{{ content.pk }}');
            activateAjaxUploadFormset($container, '{{ content.identifier }}s');
        });
    </script>
{% endblock %}
