chill_document_edit_button: create new twig extension

This commit is contained in:
2022-02-02 12:44:04 +01:00
parent 53e03395f2
commit 2af3de4f61
7 changed files with 105 additions and 3 deletions

View File

@@ -11,13 +11,13 @@
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
{% endblock %}
{% block content %}
@@ -68,7 +68,7 @@
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\PersonBundle\Entity\AccompanyingPeriod" data-entity-id="{{ accompanyingCourse.id }}"></div>
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}
<ul class="record_actions">
<ul class="record_actions sticky-form-buttons">
<li class="create">
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
{{ 'Create'|trans }}

View File

@@ -13,6 +13,7 @@
{{ 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 %}
@@ -49,6 +50,9 @@
<li>
{{ m.download_button(document.object, document.title) }}
</li>
{% if chill_document_is_editable(document.object) %}
<li>{{ document.object|chill_document_edit_button }}</li>
{% endif %}
{% 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">
@@ -74,4 +78,5 @@
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
{{ encore_entry_script_tags('mod_wopi_link') }}
{% endblock %}

View File

@@ -0,0 +1,15 @@
{% set button = {
'changeIcon': 'fa-unlock',
} %}{#
'changeClass': 'btn-update'
'noText': false
data-doc-title="{{ document.title|e('html_attr') }}"
{{ dump() }}
#}
<span data-module="wopi-link"
data-wopi-url="{{ path('chill_wopi_file_edit', {'fileId': document.uuid}) }}"
data-doc-title="coucou"
data-doc-type="{{ document.type|e('html_attr') }}"
data-button="{{ button|json_encode }}"
></span>