From 3ffeaf419af895b4c63e1ed21f189703483d838d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 9 Feb 2022 17:37:35 +0100 Subject: [PATCH] mimetype document mapping (temporary) --- .../views/Macro/macro_mimeicon.html.twig | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Macro/macro_mimeicon.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Macro/macro_mimeicon.html.twig index 15b92da84..ff5e533e4 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/Macro/macro_mimeicon.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Macro/macro_mimeicon.html.twig @@ -1,6 +1,8 @@ {% macro mimeIcon(type) %} - {# mapping forkawesome and mime type https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922 #} + {# mapping + forkawesome and mime type https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922 + #} {% set mapmime = { 'image': 'fa-file-image-o', 'audio': 'fa-file-audio-o', @@ -30,8 +32,24 @@ {% endif %} {% endfor %} + {# TODO improve mapping + mime type and friendly name https://gist.github.com/rosskmurphy/3724501 + #} + {% set maptype = { + 'fa-file-word-o': 'document/texte', + 'fa-file-excel-o': 'document/tableur', + 'fa-file-powerpoint-o': 'document/presentation', + } %} + + {% set label = type %} + {% for key, val in maptype %} + {% if icon == key %} + {% set label = val %} + {% endif %} + {% endfor %} +
- {{ type }} + {{ label|capitalize }}
{% endmacro %} \ No newline at end of file