From f48eff4e0a10dfac026532409bb60e24c4caafbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Wed, 28 Jan 2015 15:21:44 +0100 Subject: [PATCH] =?UTF-8?q?Affiche=20les=20contraintes=20de=20taile/nombre?= =?UTF-8?q?=20apr=C3=A8s=20le=20bouton=20d'ajout.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resources/translations/messages.fr.yml | 7 +++++++ Resources/views/Form/file_upload.html.twig | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index bdbe1a71..d24d13e9 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -1,2 +1,9 @@ button.upload: Ajouter un fichier + +form: + file_upload: + description.placeholder: Description facultative + max_number_of_files(%num%): %num% fichiers maximum + min_file_size: Taille minimale + max_file_size: Taille maximale diff --git a/Resources/views/Form/file_upload.html.twig b/Resources/views/Form/file_upload.html.twig index 5340baa7..884b6693 100644 --- a/Resources/views/Form/file_upload.html.twig +++ b/Resources/views/Form/file_upload.html.twig @@ -58,5 +58,14 @@ {%- if disabled or read_only %} disabled="disabled"{% endif -%} /> </div> + {% if multiple and widget_attr["data-max-number-of-files"] is defined %} + <small>{% trans with {"%num%": widget_attr["data-max-number-of-files"]}%}form.file_upload.max_number_of_files(%num%){% endtrans %}.</small> + {% endif %} + {% if widget_attr["data-min-file-size"] is defined %} + <small>{% trans %}form.file_upload.min_file_size{% endtrans %} : <span class="size" data-size-precision="0">{{ widget_attr["data-min-file-size"] }}</span></small> + {% endif %} + {% if widget_attr["data-max-file-size"] is defined %} + <small>{% trans %}form.file_upload.max_file_size{% endtrans %} : <span class="size" data-size-precision="0">{{ widget_attr["data-max-file-size"] }}</span></small> + {% endif %} </div> {% endblock file_upload_widget %} -- GitLab