mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
document: add macro mapping forkawesome icon from mime type
This commit is contained in:
parent
06b3d63133
commit
b8d43f36eb
@ -3,6 +3,7 @@
|
||||
{% set activeRouteKey = '' %}
|
||||
|
||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||
|
||||
{% block title %}
|
||||
{# {{ 'Detail of document of %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
|
||||
@ -19,8 +20,9 @@
|
||||
{% block content %}
|
||||
<div class="document-show">
|
||||
<h1>{{ block('title') }}</h1>
|
||||
{{ mm.mimeIcon(document.object.type) }}
|
||||
|
||||
<dl class="chill_view_data">
|
||||
<dl class="chill_view_data mt-4">
|
||||
<dt>{{ 'Title'|trans }}</dt>
|
||||
<dd>{{ document.title }}</dd>
|
||||
|
||||
@ -62,7 +64,7 @@
|
||||
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
|
||||
<li>
|
||||
<a href="{{ path('accompanying_course_document_edit', {'id': document.id, 'course': accompanyingCourse.id}) }}"
|
||||
class="btn btn-edit" title="{{ 'Edit' | trans }}"></a>
|
||||
class="btn btn-edit" title="{{ 'Edit attributes' | trans }}"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}
|
||||
|
@ -0,0 +1,37 @@
|
||||
{% macro mimeIcon(type) %}
|
||||
|
||||
{# mapping forkawesome and mime type https://gist.github.com/colemanw/9c9a12aae16a4bfe2678de86b661d922 #}
|
||||
{% set mapmime = {
|
||||
'image': 'fa-file-image-o',
|
||||
'audio': 'fa-file-audio-o',
|
||||
'video': 'fa-file-video-o',
|
||||
'application/pdf': 'fa-file-pdf-o',
|
||||
'application/msword': 'fa-file-word-o',
|
||||
'application/vnd.ms-word': 'fa-file-word-o',
|
||||
'application/vnd.oasis.opendocument.text': 'fa-file-word-o',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml': 'fa-file-word-o',
|
||||
'application/vnd.ms-excel': 'fa-file-excel-o',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml': 'fa-file-excel-o',
|
||||
'application/vnd.oasis.opendocument.spreadsheet': 'fa-file-excel-o',
|
||||
'application/vnd.ms-powerpoint': 'fa-file-powerpoint-o',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml': 'fa-file-powerpoint-o',
|
||||
'application/vnd.oasis.opendocument.presentation': 'fa-file-powerpoint-o',
|
||||
'text/plain': 'fa-file-text-o',
|
||||
'text/html': 'fa-file-code-o',
|
||||
'application/json': 'fa-file-code-o',
|
||||
'application/gzip': 'fa-file-archive-o',
|
||||
'application/zip': 'fa-file-archive-o',
|
||||
} %}
|
||||
|
||||
{% set icon = 'fa-file-o' %}
|
||||
{% for key,val in mapmime %}
|
||||
{% if type starts with key %}
|
||||
{% set icon = val %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<div class="metadata">
|
||||
<i class="fa {{ icon }} fa-lg me-1"></i>
|
||||
{{ type }}
|
||||
</div>
|
||||
{% endmacro %}
|
@ -10,6 +10,7 @@ New document for %name%: Nouveau document pour %name%
|
||||
Editing document for %name%: Modification d'un document pour %name%
|
||||
Edit Document: Modification d'un document
|
||||
Update document: Modifier le document
|
||||
Edit attributes: Modifier les propriétés du document
|
||||
Existing document: Document existant
|
||||
No document to download: Aucun document à télécharger
|
||||
'Choose a document category': Choisissez une catégorie de document
|
||||
|
Loading…
x
Reference in New Issue
Block a user