mimetype document mapping (temporary)

This commit is contained in:
Mathieu Jaumotte 2022-02-09 17:37:35 +01:00
parent ce2f64acd0
commit 3ffeaf419a

View File

@ -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 %}
<div class="metadata">
<i class="fa {{ icon }} fa-lg me-1"></i>
{{ type }}
{{ label|capitalize }}
</div>
{% endmacro %}