From 883a8ddf12bb76b1a3c3a9a4118ccdf8f1f9367e Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 13 Mar 2023 10:52:01 +0100
Subject: [PATCH] Fix #926

---
 .../blocks/templates/files/_preview.html.erb         | 12 ++++++++----
 app/views/extranet/library/documents/index.html.erb  |  8 ++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/app/views/admin/communication/blocks/templates/files/_preview.html.erb b/app/views/admin/communication/blocks/templates/files/_preview.html.erb
index 54f327456..71babf133 100644
--- a/app/views/admin/communication/blocks/templates/files/_preview.html.erb
+++ b/app/views/admin/communication/blocks/templates/files/_preview.html.erb
@@ -27,10 +27,14 @@ end
           <li>
           <figure>
               <a href="<%= element.blob.url %>" target="_blank" title="<%= element.title %>"><%= element.title %></a>
-              <figcaption>
-                <abbr title="">TODO : EXTENSION</abbr>
-                - <abbr title="">TODO : TAILLE FICHIER</abbr>
-              </figcaption>
+              <% if document.file.attached? %>
+                <% file = document.file %>
+                <figcaption>
+                  <abbr title=""><%= file.filename.extension.upcase %></abbr>
+                  - <abbr title=""><%= number_to_human_size file.byte_size %></abbr>
+                </figcaption>
+              <% end %>
+
             </figure>
             </a>
           </li>
diff --git a/app/views/extranet/library/documents/index.html.erb b/app/views/extranet/library/documents/index.html.erb
index e84363871..20f6d68db 100644
--- a/app/views/extranet/library/documents/index.html.erb
+++ b/app/views/extranet/library/documents/index.html.erb
@@ -13,10 +13,10 @@
               <i class="bi bi-file-earmark-text display-1"></i>
               <% if document.file.attached? %>
                 <% file = document.file %>
-              <span>
-                <%= file.filename.extension.upcase %> - 
-                <%= number_to_human_size file.byte_size %>
-              </span>
+                <span>
+                  <%= file.filename.extension.upcase %>
+                  - <%= number_to_human_size file.byte_size %>
+                </span>
               <% end %>
             </div>
             <p class="mb-3">
-- 
GitLab