Commit c4ca67f3 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

FileUploadType: gère les paramètres "disabled" et "read_only".

Showing with 13 additions and 3 deletions
+13 -3
......@@ -141,6 +141,10 @@
fileuploadprocessalways: updateButtonVisibility
});
if(options.disabled || options.readonly) {
$button.fileupload('disable');
}
};
})(jQuery);
......@@ -17,7 +17,10 @@
{% block file_upload_widget %}
<div id="{{ id }}" {{ 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-upload-prototype="{{ block('file_upload_progress_prototype')|e }}"
{% if disabled %}data-disabled="disabled"{% endif -%}
{% if read_only %}data-readonly="readonly"{% endif -%}
>
<div class="fileinput-entries">
{%- if value is not empty %}
{%- if multiple %}
......@@ -30,7 +33,7 @@
{%- set file = file|default([]) %}
<p class="template-download">
<input type="hidden" name="{{ full_name }}{% if multiple %}[]{% endif %}" value="{{ file.id|default }}"/>
<button class="btn btn-xs btn-danger delete" title="{% trans %}button.delete{% endtrans %}">
<button class="btn btn-xs btn-danger delete" title="{% trans %}button.delete{% endtrans %}" {%- if disabled or read_only %} disabled="disabled"{% endif -%}>
{{- irstea_icon('trash') -}}
</button>&nbsp;<span class="name">
<a{% if file %} href="{{ path('file_upload_get', {id: file.id, token: csrfToken}) }}"{% endif %}>{{ file.originalFilename|default }}</a>
......@@ -45,7 +48,10 @@
</div>
<span class="btn btn-primary fileinput-button">
<span>{{ irstea_icon('upload') }}&nbsp;{% trans %}button.upload{% endtrans %}</span>
<input type="file" name="_hack_{{ full_name }}"{% if multiple %} multiple="multiple"{% endif %}/>
<input type="file" name="_hack_{{ full_name }}"
{%- if multiple %} multiple="multiple"{% endif -%}
{%- if disabled or read_only %} disabled="disabled"{% endif -%}
/>
</span>
</div>
{% endblock file_upload_widget %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment