mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix review remarks
This commit is contained in:
parent
e7a6742964
commit
5a692db30f
@ -1,4 +1,5 @@
|
||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||
|
||||
<div class="flex-table accompanying_course_work-list">
|
||||
<div class="item-bloc document-item bg-chill-llight-gray">
|
||||
@ -8,10 +9,11 @@
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<h3>{{ document.title }}</h3>
|
||||
<small>{{ document.object.type }}</small>
|
||||
|
||||
|
||||
{{ mm.mimeIcon(document.object.type) }}
|
||||
|
||||
{% if document.description is not empty %}
|
||||
<blockquote class="chill-user-quote mt-2">
|
||||
<blockquote class="chill-user-quote mt-4">
|
||||
{{ document.description }}
|
||||
</blockquote>
|
||||
{% endif %}
|
||||
@ -36,12 +38,14 @@
|
||||
{{ m.download_button(document.object, document.title) }}
|
||||
</li>
|
||||
<li>
|
||||
{% if not freezed %}
|
||||
{{ document.object|chill_document_edit_button({'changeIcon': 'fa-unlock', 'title': document.title|e('html') }) }}
|
||||
{% else %}
|
||||
<a class="btn btn-update change-icon disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
|
||||
<i class="fa fa-lock me-2"></i>{{ 'Update document'|trans }}
|
||||
</a>
|
||||
{% if chill_document_is_editable(document.object) %}
|
||||
{% if not freezed %}
|
||||
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
|
||||
{% else %}
|
||||
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
|
||||
{{ 'Update document'|trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -14,7 +14,9 @@
|
||||
{{ parent() }}
|
||||
{{ encore_entry_link_tags('mod_async_upload') }}
|
||||
{{ encore_entry_link_tags('mod_entity_workflow_pick') }}
|
||||
{#
|
||||
{{ encore_entry_link_tags('mod_wopi_link') }}
|
||||
#}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@ -82,5 +84,7 @@
|
||||
{{ parent() }}
|
||||
{{ encore_entry_script_tags('mod_async_upload') }}
|
||||
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
|
||||
{#
|
||||
{{ encore_entry_script_tags('mod_wopi_link') }}
|
||||
#}
|
||||
{% endblock %}
|
@ -36,9 +36,9 @@
|
||||
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',
|
||||
'fa-file-word-o': 'office document/texte',
|
||||
'fa-file-excel-o': 'office document/tableur',
|
||||
'fa-file-powerpoint-o': 'office document/presentation',
|
||||
} %}
|
||||
|
||||
{% set label = type %}
|
||||
|
@ -31,10 +31,7 @@ class WopiEditTwigExtension extends AbstractExtension
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('chill_document_is_editable', [WopiEditTwigExtensionRuntime::class, 'isEditable'], [
|
||||
'needs_environment' => true,
|
||||
'is_safe' => ['html'],
|
||||
]),
|
||||
new TwigFunction('chill_document_is_editable', [WopiEditTwigExtensionRuntime::class, 'isEditable']),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -36,18 +36,18 @@ class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
]);
|
||||
}
|
||||
|
||||
public function isEditable(Environment $environment, StoredObject $document): bool
|
||||
public function isEditable(StoredObject $document): bool
|
||||
{
|
||||
$mime_type = $this->discovery->discoverMimeType($document->getType());
|
||||
|
||||
if (empty($mime_type)) {
|
||||
if ([] === $mime_type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (array_key_exists('default', $mime_type[0])
|
||||
&& $mime_type[0]['default'] === 'true'
|
||||
) {
|
||||
return true;
|
||||
foreach ($mime_type as $item) {
|
||||
if (array_key_exists('default', $item) && $item['default'] === 'true') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user