[person bloc] handle null values in date + improve layout on dead person

and age
This commit is contained in:
2021-08-23 19:15:00 +02:00
parent bfed062910
commit 7d6def733c
3 changed files with 31 additions and 10 deletions

View File

@@ -60,23 +60,32 @@
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle|trans }}"></i>
{%- if person.deathdate is not null -%}
{%- if person.birthdate is not null -%}
<time datetime="{{ person.birthdate|date('Y-m-d') }}" title="{{ 'birthdate'|trans|e('html_attr') }}">
{{ person.birthdate|format_date("medium") }}
</time>
&#x002D;
{%- else -%}
{{ 'Date of death'|trans }}:
{%- endif -%}
<time datetime="{{ person.deathdate|date('Y-m-d') }}" title="{{ 'Deathdate'|trans }}">
{{ 'Date of death'|trans({'deathdate': person.deathdate|format_date("medium") }) }}
{{ person.deathdate|format_date("medium") }}
</time>
{%- else -%}
{% if options['addAge'] %}
<span class="age">
({{ 'years_old'|trans({ 'age': person.age }) }})
</span>
{% endif %}
{%- elseif person.birthdate is not null -%}
<time datetime="{{ person.birthdate|date('Y-m-d') }}" title="{{ 'Birthdate'|trans }}">
{{ 'Born the date'|trans({'gender': person.gender,
'birthdate': person.birthdate|format_date("medium") }) }}
</time>
{%- if options['addAge'] -%}
<span class="age">
{{ 'years_old'|trans({ 'age': person.age }) }}
({{ 'years_old'|trans({ 'age': person.age }) }})
</span>
{%- endif -%}
{%- endif -%}
</p>
{%- endif -%}
@@ -141,7 +150,7 @@
{{ options['customButtons']['replace'] }}
{%- elseif is_granted('CHILL_PERSON_SEE', person) -%}
<li>
<a class="btn btn-sm btn-show" target="_blank" title="{{ 'Show person'|trans }}"
<a class="btn btn-sm btn-show" title="{{ 'Show person'|trans }}"
href="{{ path('chill_person_view', { person_id: person.id }) }}"></a>
</li>
{%- else -%}