From c66270f1fbfaa81c2c43d44780a954a538d7b37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 19 Dec 2013 17:59:22 +0100 Subject: [PATCH] allow layout to print people without dateOfBirth --- Resources/views/Person/view.html.twig | 3 ++- Resources/views/layout.html.twig | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Resources/views/Person/view.html.twig b/Resources/views/Person/view.html.twig index efdb9e4fb..5eccecc6c 100644 --- a/Resources/views/Person/view.html.twig +++ b/Resources/views/Person/view.html.twig @@ -45,7 +45,8 @@ This view should receive those arguments:
{{ 'views.Person.view.dateOfBirth'|trans }}
-
{{ person.dateOfBirth.format(date_format) }}
+
{{ person.dateOfBirth.format(date_format) + |default( 'person.without_date_of_birth'|trans ) }}
{{ 'views.Person.view.placeOfBirth'|trans }}
diff --git a/Resources/views/layout.html.twig b/Resources/views/layout.html.twig index 82b6504d2..b0c5a09c6 100644 --- a/Resources/views/layout.html.twig +++ b/Resources/views/layout.html.twig @@ -24,8 +24,16 @@ {% endspaceless %} -

{% transchoice person.genreNumeric - with {'%date%' : person.dateOfBirth.format('d-m-Y')} %}views.layout.born{% endtranschoice %}

+

{% spaceless %} + {% if person.dateOfBirth == null %} + {{ 'person.without_date_of_birth'|trans }}, {{ ('person.gender.' ~ + person.genre)|trans }} + {% else %} + {% transchoice person.genreNumeric + with {'%date%' : person.dateOfBirth.format('d-m-Y')} %}views.layout.born{% endtranschoice %} + + {% endif %} + {% endspaceless %}

{% if person.nationality is not null %}

{{ person.nationality.label }}

{% else %}