render box, mechanism to pass custom buttons

This commit is contained in:
2021-07-29 11:20:45 +02:00
parent 4e9916534f
commit ad3fe7cf91
5 changed files with 36 additions and 23 deletions

View File

@@ -6,6 +6,19 @@
{{ 'Resume Accompanying Course'|trans }}
{% endblock %}
{% macro button_person(person) %}
{% if person.isSharingHousehold %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': person.getCurrentHousehold.id }) }}"
class="btn btn-misc">
<i class="fa fa-home"></i>
n°&nbsp;
{{ person.getCurrentHousehold.id }}
</a>
</li>
{% endif %}
{% endmacro %}
{% block content %}
<div class="accompanyingcourse-resume">
@@ -27,25 +40,11 @@
{% if participation.enddate is null %}
<div class="item-bloc">
{{ participation.person|chill_entity_render_box({
'render': 'bloc', 'addLink': false, 'addInfo': true
'render': 'bloc', 'addLink': false, 'addInfo': true, 'customButtons': _self.button_person(participation.person)
}) }}
</div>
{% endif %}
{% endfor %}
{# AJOUTER ACTIONS
<ul class="record_actions">
{% if p.person.isSharingHousehold %}
<li>
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': p.person.getCurrentHousehold.id }) }}"
class="btn btn-misc">
<i class="fa fa-home"></i>
n°&nbsp;
{{ p.person.getCurrentHousehold.id }}
</a>
</li>
{% endif %}
</ul>
#}
</div>
{% if withoutHousehold|length > 0 %}
{% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' with {} %}

View File

@@ -7,6 +7,7 @@
* addEntity bool
* addInfo bool
* hLevel integer
* customButtons Twig\Markup (html)
#}
{% macro raw(person, options) %}
@@ -92,13 +93,17 @@
{%- endif -%}
</li>
</ul>
{%- if is_granted('CHILL_PERSON_SEE', person) -%}
<ul class="record_actions">
<li><a class="btn btn-show" target="_blank" title="{{ 'Show'|trans }}"
href="{{ path('chill_person_view', { person_id: person.id }) }}"></a>
</li>
{%- if is_granted('CHILL_PERSON_SEE', person) -%}
<li>
<a class="btn btn-show" target="_blank" title="{{ 'Show'|trans }}"
href="{{ path('chill_person_view', { person_id: person.id }) }}"></a>
</li>
{%- endif -%}
{% if options['customButtons'] %}
{{ options['customButtons'] }}
{% endif %}
</ul>
{%- endif -%}
</div>
</div>
{%- endif -%}