From 35842bba0adc0b71376c3e4f11a560a9e88e25f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr>
Date: Thu, 22 Jan 2015 14:28:30 +0100
Subject: [PATCH] =?UTF-8?q?irsteaFileUpload:=20n'affiche=20la=20progressio?=
 =?UTF-8?q?n=20que=20si=20n=C3=A9cessaire.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Resources/js/widget/file_upload.js         | 6 ++++--
 Resources/views/Form/file_upload.html.twig | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Resources/js/widget/file_upload.js b/Resources/js/widget/file_upload.js
index c060a609..77573e76 100644
--- a/Resources/js/widget/file_upload.js
+++ b/Resources/js/widget/file_upload.js
@@ -109,7 +109,6 @@
                         function(response) {
                             data.url = response.url;
                             data.jqXHR = $this.fileupload('send', data);
-                            data.context.find('.progress').show();
                         }
                     );
                     return false;
@@ -121,9 +120,12 @@
                     var progress = Math.floor(data.loaded / data.total * 100);
                     data.context.each(function () {
                         $(this).find('.progress')
+                            .show()
                             .attr('aria-valuenow', progress)
                             .children().first().css('width',progress + '%');
-                        $(this).find('.progress-text').html(progress + '% ('+formatBitrate(data.bitrate)+')');
+                        $(this).find('.progress-text')
+                            .show()
+                            .html(progress + '% ('+formatBitrate(data.bitrate)+')');
                     });
                 }
             }
diff --git a/Resources/views/Form/file_upload.html.twig b/Resources/views/Form/file_upload.html.twig
index f8055730..fcf05f0d 100644
--- a/Resources/views/Form/file_upload.html.twig
+++ b/Resources/views/Form/file_upload.html.twig
@@ -2,7 +2,7 @@
 {% block file_upload_progress_prototype %}
     <div class="template-upload">
         <p>
-            <span class="progress-text pull-right"></span>
+            <span class="progress-text pull-right" style="display: none"></span>
             <button class="btn btn-xs btn-danger cancel" title="{% trans %}button.cancel{% endtrans %}">
                 {{ irstea_icon('remove') }}
             </button>&nbsp;<span class="name"></span>&nbsp;(<span class="size"></span>)
-- 
GitLab