allow layout to print people without dateOfBirth

This commit is contained in:
Julien Fastré 2013-12-19 17:59:22 +01:00
parent 9f3cf26c13
commit c66270f1fb
2 changed files with 12 additions and 3 deletions

View File

@ -45,7 +45,8 @@ This view should receive those arguments:
<dl>
<dt class="inline">{{ 'views.Person.view.dateOfBirth'|trans }}</dt>
<dd>{{ person.dateOfBirth.format(date_format) }}</dd>
<dd>{{ person.dateOfBirth.format(date_format)
|default( 'person.without_date_of_birth'|trans ) }}</dd>
<dt class="inline">{{ 'views.Person.view.placeOfBirth'|trans }}</dt>

View File

@ -24,8 +24,16 @@
{% endspaceless %}
</h1>
<p class="date detail">{% transchoice person.genreNumeric
with {'%date%' : person.dateOfBirth.format('d-m-Y')} %}views.layout.born{% endtranschoice %}</p>
<p class="date detail">{% 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 %}</p>
{% if person.nationality is not null %}
<p class="nationality detail">{{ person.nationality.label }}</p>
{% else %}