Take next calendars twig code out of person renderbox and add it directly to list_with_period.html.twig

This commit is contained in:
2025-11-24 13:15:32 +01:00
parent ce74233282
commit 0e2cc6cc3a
3 changed files with 41 additions and 46 deletions

View File

@@ -14,7 +14,6 @@
* addAgeBadge bool * addAgeBadge bool
* suffixText bool * suffixText bool
* address_multiline bool * address_multiline bool
* addNextCalendars bool
* customButtons [ * customButtons [
'before' Twig\Markup, (injected with macro) 'before' Twig\Markup, (injected with macro)
'replace' Twig\Markup, 'replace' Twig\Markup,
@@ -215,46 +214,3 @@
</div> </div>
</div> </div>
{%- endif -%} {%- endif -%}
{%- if options['addNextCalendars'] -%}
{% set calendars = [] %}
{% for c in person.getNextCalendarsForPerson(10) %}
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', c) %}
{% set calendars = calendars|merge([c]) %}
{% endif %}
{% endfor %}
{% if calendars|length > 0 %}
<div class="wrap-list periods-list">
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'chill_calendar.Next calendars'|trans }}</h3>
</div>
<div class="wl-col list">
<div class="calendar-list">
<ul class="calendar-list">
{% for c in calendars %}
<li>
{% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', c) %}
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_edit', { id: c.id }) }}">
<span class="badge bg-secondary">
{{ c.startDate|format_datetime('long', 'short') }}
</span>
</a>
{% else %}
<span class="badge bg-secondary">
{{ c.startDate|format_datetime('long', 'short') }}
</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', person) %}
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_list_by_person', {'id': person.id}) }}" class="calendar-list__global"><i class="fa fa-list"></i></a>
{% endif %}
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}

View File

@@ -298,10 +298,50 @@
'addAltNames': true, 'addAltNames': true,
'addCenter': true, 'addCenter': true,
'address_multiline': false, 'address_multiline': false,
'addNextCalendars': true,
'customButtons': { 'after': _self.button_person_after(person), 'before': _self.button_person_before((person)) } 'customButtons': { 'after': _self.button_person_after(person), 'before': _self.button_person_before((person)) }
}) }} }) }}
{% set calendars = [] %}
{% for c in person.getNextCalendarsForPerson(10) %}
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', c) %}
{% set calendars = calendars|merge([c]) %}
{% endif %}
{% endfor %}
{% if calendars|length > 0 %}
<div class="wrap-list periods-list">
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'chill_calendar.Next calendars'|trans }}</h3>
</div>
<div class="wl-col list">
<div class="calendar-list">
<ul class="calendar-list">
{% for c in calendars %}
<li>
{% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', c) %}
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_edit', { id: c.id }) }}">
<span class="badge bg-secondary">
{{ c.startDate|format_datetime('long', 'short') }}
</span>
</a>
{% else %}
<span class="badge bg-secondary">
{{ c.startDate|format_datetime('long', 'short') }}
</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% if is_granted('CHILL_CALENDAR_CALENDAR_SEE', person) %}
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_list_by_person', {'id': person.id}) }}" class="calendar-list__global"><i class="fa fa-list"></i></a>
{% endif %}
</div>
</div>
</div>
</div>
{% endif %}
{#- 'acps' is for AcCompanyingPeriodS #} {#- 'acps' is for AcCompanyingPeriodS #}
{%- set acps = [] %} {%- set acps = [] %}
{%- set acpsClosed = [] %} {%- set acpsClosed = [] %}

View File

@@ -46,7 +46,6 @@ class PersonRender implements PersonRenderInterface
'addDeath' => $options['addDeath'] ?? true, 'addDeath' => $options['addDeath'] ?? true,
'addAgeBadge' => $options['addAgeBadge'] ?? false, 'addAgeBadge' => $options['addAgeBadge'] ?? false,
'suffixText' => $options['suffixText'] ?? [], 'suffixText' => $options['suffixText'] ?? [],
'addNextCalendars' => $options['addNextCalendars'] ?? false,
]; ];
return return