+{#
+ Template to render an address
+ OPTIONS
+ * has_no_address bool
+ * multiline bool
+ * with_valid_from bool
+#}
+
{% if options['has_no_address'] == true and address.isNoAddress == true %}
-
{{ 'address.consider homeless'|trans }}
- {% endif %}
-
- {% if address.street is not empty %}
{{ address.street }}
{% endif %}
- {% if address.streetNumber is not empty %}
{{ address.streetNumber }}
{% endif %}
- {% if address.postCode is not empty %}
-
{{ address.postCode.code }} {{ address.postCode.name }}
-
{{ address.postCode.country.name|localize_translatable_string }}
+
+ {{ 'address.consider homeless'|trans }}
+
{% endif %}
+
+
+ {% if address.street is not empty %}
+
{{ address.street }}
+ {% endif %}
+ {% if address.streetNumber is not empty %}
+
{{ address.streetNumber }}
+ {% endif %}
+ {% if address.postCode is not empty %}
+
+ {{ address.postCode.code }}
+ {{ address.postCode.name }}
+
+
{{ address.postCode.country.name|localize_translatable_string }}
+ {% endif %}
-{%- if options['with_valid_from'] == true -%}
-
{{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }}
-{%- endif -%}
+
+ {%- if options['with_valid_from'] == true -%}
+
+ {{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }}
+
+ {%- endif -%}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig
deleted file mode 100644
index 990dbc043..000000000
--- a/src/Bundle/ChillMainBundle/Resources/views/Address/macro.html.twig
+++ /dev/null
@@ -1,21 +0,0 @@
-{%- macro _render(address, options) -%}
- {%- set options = { 'with_valid_from' : true }|merge(options|default({})) -%}
- {%- set options = { 'has_no_address' : false }|merge(options|default({})) -%}
- {%- set options = { 'with_icon' : false }|merge(options|default({})) -%}
-
- {% if options['has_no_address'] == true and address.isNoAddress == true %}
-
{{ 'address.consider homeless'|trans }}
- {% endif %}
-
{% if options['with_icon'] == true %}
{% endif %}
- {% if address.street is not empty %}
{{ address.street }}
{% endif %}
- {% if address.streetNumber is not empty %}
{{ address.streetNumber }}
{% endif %}
- {% if address.postCode is not empty %}
-
{{ address.postCode.code }} {{ address.postCode.name }}
-
{{ address.postCode.country.name|localize_translatable_string }}
- {% endif %}
-
- {%- if options['with_valid_from'] == true -%}
-
{{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }}
- {%- endif -%}
-
-{%- endmacro -%}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
index ac1d1748b..bb42a390a 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig
@@ -1,7 +1,5 @@
{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %}
-{% import '@ChillMain/Address/macro.html.twig' as address %}
-
{% block title %}
{{ 'Resume Accompanying Course'|trans }}
{% endblock %}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig
index 6f6a90d81..80f68a84e 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/list.html.twig
@@ -16,110 +16,94 @@
#}
{% extends "@ChillPerson/Person/layout.html.twig" %}
-{% import '@ChillMain/Address/macro.html.twig' as address_macros %}
-
{% set activeRouteKey = '' %}
{% block title %}{{ 'Addresses history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}{% endblock %}
{% block personcontent %}
-
-
{{ 'Addresses history'|trans }}
-
-
-
- {% if person.addresses|length == 0 %}
-
{{ 'No address given'|trans }}
- {% else %}
-
- {% endif %}
-
- {% for address in person.addresses %}
-
- {# if person address #}
-
-
- {% if address.isNoAddress == true %}
-
{{ 'address.consider homeless'|trans }}
- {% else %}
-
- {% if address.street is not empty %}
-
- {{ address.street }}
- {% if address.streetNumber is not empty %}
- , {{ address.streetNumber }}
- {% endif %}
-
- {% endif %}
-
- {% if address.postCode is not empty %}
-
- {{ address.postCode.code }} {{ address.postCode.name }}
- ({{ address.postCode.country.name|localize_translatable_string }})
-
- {% endif %}
-
- {% endif %}
-
-
-
-
- {# endif #}
-
-
-
- {# if household address #}{#
-
- #}{# endif #}
-
-
- {% if address.validFrom is not empty %}
- {{ address.validFrom|format_date('long') }}
- {% endif %}
-
-
- {% endfor %}
-
- {# TEST HOUSEHOLD POSITION
- #}
-
-
-
-
- 549, chemin De Sousa
- , 45, boulevard Aurore Roux
-
-
- 10850 Nanterre (France)
-
-
-
+
+
{{ 'Addresses history'|trans }}
+
+
+
+ {% if person.addresses|length == 0 %}
+
{{ 'No address given'|trans }}
+ {% else %}
+
+ {% endif %}
+
+ {% for address in person.addresses %}
+
+ {# if person address #}
+
+
+ {% if address.isNoAddress == true %}
+
{{ 'address.consider homeless'|trans }}
+ {% else %}
+ {{ address|chill_entity_render_box({
+ 'multiline': false, 'with_valid_from': false
+ }) }}
+ {% endif %}
+
+
-
01 janvier 1970
- {# END TEST #}
-
+
+ {# endif #}
+
+
+
+ {# if household address #}{#
+
+ #}{# endif #}
+
+
+ {% if address.validFrom is not empty %}
+ {{ address.validFrom|format_date('long') }}
+ {% endif %}
-
-
+ {% endfor %}
+
+ {# TEST HOUSEHOLD POSITION
+ #}
+
+
+
+
+ 549, chemin De Sousa
+ , 45, boulevard Aurore Roux
+
+
+ 10850 Nanterre (France)
+
+
+
+
+
01 janvier 1970
+ {# END TEST #}
+
+
+
+
+
{% endblock %}
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig
index 3a51e8939..93c9c0904 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig
@@ -16,8 +16,6 @@
#}
{% extends "@ChillPerson/Person/layout.html.twig" %}
-{% import '@ChillMain/Address/macro.html.twig' as address %}
-
{% set activeRouteKey = 'chill_person_view' %}
{#
@@ -171,7 +169,7 @@ This view should receive those arguments:
{{ 'Address'|trans }}
{%- if person.lastAddress is not empty -%}
- {{ address._render(person.lastAddress, {'has_no_address': true}) }}
+ {{ person.lastAddress|chill_entity_render_box({'has_no_address': true}) }}
-
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig
index 098737aaf..f7fef7f93 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig
@@ -1,7 +1,5 @@
{%- macro details(person, options) -%}
-{% import '@ChillMain/Address/macro.html.twig' as address %}
-
- {{ 'gender'|trans }}:
{{ person.gender|trans }}
@@ -24,7 +22,9 @@
- {{ 'memo'|trans }}:
{{ person.memo }}
- {{ 'address'|trans }}:
- {%- if person.lastAddress is not empty -%}{{ address._render(person.lastAddress, {'with_valid_from': false}) }}{% endif %}
+ {%- if person.lastAddress is not empty -%}
+ {{ person.lastAddress|chill_entity_render_box({'with_valid_from': false}) }}
+ {% endif %}
- {{ 'spokenLanguages'|trans }}:
{% for lang in person.spokenLanguages %}{{ lang.name|localize_translatable_string }}{% if not loop.last %},{% endif %}{% endfor %}
- {{ 'contactInfo'|trans }}:
@@ -43,4 +43,4 @@
- {{ person.counters.nb_addresses }} {{ (person.counters.nb_addresses > 1)? 'adresses' : 'adresse' }}
-{% endmacro %}
\ No newline at end of file
+{% endmacro %}
diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
index 8a54e4d38..603aa91ee 100644
--- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
+++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php
@@ -25,7 +25,6 @@ use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Symfony\Component\Templating\EngineInterface;
-
/**
* Render a Person
*
@@ -83,7 +82,7 @@ class PersonRender extends AbstractChillEntityRender
.$this->addAltNames($person, false);
}
- protected function addAltNames(Person $person, bool $addSpan)
+ protected function addAltNames(Person $person, bool $addSpan): string
{
$str = '';
@@ -101,7 +100,7 @@ class PersonRender extends AbstractChillEntityRender
$str.= " ";
}
if ($addSpan) {
- $str .= '';
+ $str .= '';
}
$str .= $altName->getLabel();
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig
index 19956d2ce..a691605eb 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/show.html.twig
@@ -1,7 +1,5 @@
{% extends "@ChillMain/layout.html.twig" %}
-{% import '@ChillMain/Address/macro.html.twig' as address %}
-
{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %}
{% block title title_ %}
@@ -38,7 +36,7 @@
{% if thirdParty.address == null %}
{{ 'No address given'|trans }}
{% else %}
- {{ address._render(thirdParty.address, {'with_valid_from': false }) }}
+ {{ thirdParty.address|chill_entity_render_box({'with_valid_from': false }) }}
{% endif %}