Forked from HYCAR-Hydro / airGR
Source project has a limited visibility.
file_upload.html.twig 2.99 KiB
{% block file_upload_progress_prototype %}
    <div class="template-upload fileinput-entry">
        <div class="progress-text" style="display: none"></div>
        <i class="fa fa-circle-o-notch fa-spin icon"></i>&nbsp;<span class="name"></span>&nbsp;(<span class="size"></span>)
        <span class="error" style="display: none"></span>
        <a href="#" class="danger cancel" title="{% trans %}button.cancel{% endtrans %}">
            {{- irstea_icon('remove') -}}
        </a>
        <div class="progress" style="display: none">
            <div class="progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div>
        </div>
    </div>
{% endblock %}
{%- block file_upload_entry_prototype %}
    {%- set file = file|default([]) %}
    <div class="template-download fileinput-entry">
        <input type="hidden" name="{{ full_name }}{% if multiple %}[]{% endif %}" value="{{ file.id|default }}"/>
        <i class="fa fa-file{% if file.icon|default(false) %}-{{ file.icon }}{% endif %}-o icon"></i>&nbsp;<span class="name">
            <a{% if file %} href="{{ path('file_upload_get_content', {id: file.id, token: csrf_token}) }}"{% endif %}>{{ file.name|default }}</a>
    </span>
        (<span class="size">
            {{- file.size|default -}}
        </span>)
        <span class="error danger" style="display: none">ERROR</span>
        <a href="#" class="danger delete {%- if disabled or read_only %} disabled{% endif -%}" title="{% trans %}button.delete{% endtrans %}">
            {{- irstea_icon('remove') -}}
        </a>
    </div>
{% endblock -%}
{% block file_upload_widget %}
    <div id="{{ id }}" class="form-control fileinput-{{ multiple ? "multiple" : "single" }}" {{ block('widget_container_attributes') }} {{ block('widget_only_attributes') }}
         data-download-prototype="{{ block('file_upload_entry_prototype')|e }}"
         data-upload-prototype="{{ block('file_upload_progress_prototype')|e }}"
         data-csrf-token="{{ csrf_token }}"
         {% if disabled %}data-disabled="disabled"{% endif -%}
         {% if read_only %}data-readonly="readonly"{% endif -%}
        <div class="fileinput-entries">
            {%- if value is not empty %}
                {%- if multiple %}
                    {% for file in value %}
                        {{ block('file_upload_entry_prototype') }}
                    {% endfor %}
                {%- else %}
                    {%- set file = value %}
                    {{- block('file_upload_entry_prototype') -}}
                {% endif -%}
            {% endif -%}
        </div>
        <div class="fileinput-button btn btn-default btn-xs">
            <span>{{ irstea_icon('upload') }}&nbsp;{% trans %}button.upload{% endtrans %}</span>
            <input type="file" name="_hack_{{ full_name }}"
                {%- if multiple %} multiple="multiple"{% endif -%}
                {%- if disabled or read_only %} disabled="disabled"{% endif -%}
        </div>
    </div>
{% endblock file_upload_widget %}