diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig index 543d0bf34..7cf331f2b 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig @@ -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 %}

{{ block('title') }}

+ {{ mm.mimeIcon(document.object.type) }} -
+
{{ 'Title'|trans }}
{{ document.title }}
@@ -62,7 +64,7 @@ {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
  • + class="btn btn-edit" title="{{ 'Edit attributes' | trans }}">
  • {% endif %} {% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/Macro/macro_mimeicon.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/Macro/macro_mimeicon.html.twig new file mode 100644 index 000000000..15b92da84 --- /dev/null +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/Macro/macro_mimeicon.html.twig @@ -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 %} + + +{% endmacro %} \ No newline at end of file diff --git a/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml b/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml index 3ee10721c..96a3821b9 100644 --- a/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml @@ -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