mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
render box address, remove macro address, refactoring (wip)
This commit is contained in:
parent
55ac730c18
commit
6dac130844
@ -11,3 +11,38 @@ section.chill-entity {
|
||||
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
||||
}
|
||||
}
|
||||
|
||||
// specific rules
|
||||
// address render_box
|
||||
div.chill-entity {
|
||||
&.entity-address {
|
||||
div.noaddress {}
|
||||
div.address {
|
||||
margin: 0.7em 0;
|
||||
font-size: 98%;
|
||||
font-variant: small-caps;
|
||||
|
||||
&.multiline {
|
||||
p {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
p {
|
||||
display: inline-block;
|
||||
margin: 0 0 0 1.5em;
|
||||
text-indent: -1.5em;
|
||||
|
||||
&.street {
|
||||
&.street1 {}
|
||||
&.street2, &.streetnumber {}
|
||||
}
|
||||
&.postalcode {
|
||||
span.code {}
|
||||
span.name {}
|
||||
}
|
||||
&.country {}
|
||||
}
|
||||
}
|
||||
span.address-since {}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,36 @@
|
||||
<div class="chill_address">
|
||||
{#
|
||||
Template to render an address
|
||||
OPTIONS
|
||||
* has_no_address bool
|
||||
* multiline bool
|
||||
* with_valid_from bool
|
||||
#}
|
||||
<div class="chill-entity entity-address">
|
||||
{% if options['has_no_address'] == true and address.isNoAddress == true %}
|
||||
<div class="chill_address_is_noaddress">{{ 'address.consider homeless'|trans }}</div>
|
||||
{% endif %}
|
||||
<div class="chill_address_address {% if options['multiline'] %}chill_address_address--multiline{% endif %}">
|
||||
{% if address.street is not empty %}<p class="street street1">{{ address.street }}</p>{% endif %}
|
||||
{% if address.streetNumber is not empty %}<p class="street street2">{{ address.streetNumber }}</p>{% endif %}
|
||||
{% if address.postCode is not empty %}
|
||||
<p class="postalCode"><span class="code">{{ address.postCode.code }}</span> <span class="name">{{ address.postCode.name }}</span></p>
|
||||
<p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p>
|
||||
<div class="noaddress">
|
||||
{{ 'address.consider homeless'|trans }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="address{% if options['multiline'] %} multiline{% endif %}">
|
||||
{% if address.street is not empty %}
|
||||
<p class="street street1">{{ address.street }}</p>
|
||||
{% endif %}
|
||||
{% if address.streetNumber is not empty %}
|
||||
<p class="street street2 streetnumber">{{ address.streetNumber }}</p>
|
||||
{% endif %}
|
||||
{% if address.postCode is not empty %}
|
||||
<p class="postalcode">
|
||||
<span class="code">{{ address.postCode.code }}</span>
|
||||
<span class="name">{{ address.postCode.name }}</span>
|
||||
</p>
|
||||
<p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{%- if options['with_valid_from'] == true -%}
|
||||
<span class="address_since">{{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }}</span>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if options['with_valid_from'] == true -%}
|
||||
<span class="address-since">
|
||||
{{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }}
|
||||
</span>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
@ -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({})) -%}
|
||||
<div class="chill_address">
|
||||
{% if options['has_no_address'] == true and address.isNoAddress == true %}
|
||||
<div class="chill_address_is_noaddress">{{ 'address.consider homeless'|trans }}</div>
|
||||
{% endif %}
|
||||
<div class="chill_address_address">{% if options['with_icon'] == true %}<i class="fa fa-fw fa-map-marker"></i>{% endif %}
|
||||
{% if address.street is not empty %}<p class="street street1">{{ address.street }}</p>{% endif %}
|
||||
{% if address.streetNumber is not empty %}<p class="street street2">{{ address.streetNumber }}</p>{% endif %}
|
||||
{% if address.postCode is not empty %}
|
||||
<p class="postalCode"><span class="code">{{ address.postCode.code }}</span> <span class="name">{{ address.postCode.name }}</span></p>
|
||||
<p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{%- if options['with_valid_from'] == true -%}
|
||||
<span class="address_since">{{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }}</span>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- endmacro -%}
|
@ -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 %}
|
||||
|
@ -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 %}
|
||||
<div class="person-addresses">
|
||||
|
||||
<h1>{{ 'Addresses history'|trans }}</h1>
|
||||
|
||||
<div class="address-timeline grid">
|
||||
|
||||
{% if person.addresses|length == 0 %}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
{% else %}
|
||||
<div class="top"><i class="fa fa-caret-up fa-3x"></i></div>
|
||||
{% endif %}
|
||||
|
||||
{% for address in person.addresses %}
|
||||
|
||||
{# if person address #}
|
||||
<div class="col-a content{{ ' row' ~ loop.index }}">
|
||||
<div class="address">
|
||||
{% if address.isNoAddress == true %}
|
||||
<div class="chill_address_is_noaddress">{{ 'address.consider homeless'|trans }}</div>
|
||||
{% else %}
|
||||
|
||||
{% if address.street is not empty %}
|
||||
<div class="street">
|
||||
<span class="streetNumber">{{ address.street }}</span>
|
||||
{% if address.streetNumber is not empty %}
|
||||
<span class="streetNumber">, {{ address.streetNumber }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if address.postCode is not empty %}
|
||||
<div class="postCode">
|
||||
<span>{{ address.postCode.code }}</span> <span>{{ address.postCode.name }}</span>
|
||||
<span class="country">({{ address.postCode.country.name|localize_translatable_string }})</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{# endif #}
|
||||
|
||||
<div class="col-b"></div>
|
||||
|
||||
{# if household address #}{#
|
||||
<div class="col-c content rowXX">
|
||||
<div class="address">...</div>
|
||||
</div>
|
||||
#}{# endif #}
|
||||
|
||||
<div class="date">
|
||||
{% if address.validFrom is not empty %}
|
||||
{{ address.validFrom|format_date('long') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{# TEST HOUSEHOLD POSITION
|
||||
#}
|
||||
<div class="col-b"></div>
|
||||
<div class="col-c content fake">
|
||||
<div class="address">
|
||||
<div class="street">
|
||||
<span class="streetNumber">549, chemin De Sousa</span>
|
||||
<span class="streetNumber">, 45, boulevard Aurore Roux</span>
|
||||
</div>
|
||||
<div class="postCode">
|
||||
<span>10850</span> <span>Nanterre</span> <span class="country">(France)</span>
|
||||
</div>
|
||||
<ul class="record_actions"><li><a href="" class="btn btn-edit"></a></li></ul>
|
||||
</div>
|
||||
|
||||
<h1>{{ 'Addresses history'|trans }}</h1>
|
||||
|
||||
<div class="address-timeline grid">
|
||||
|
||||
{% if person.addresses|length == 0 %}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
{% else %}
|
||||
<div class="top"><i class="fa fa-caret-up fa-3x"></i></div>
|
||||
{% endif %}
|
||||
|
||||
{% for address in person.addresses %}
|
||||
|
||||
{# if person address #}
|
||||
<div class="col-a content{{ ' row' ~ loop.index }}">
|
||||
<div class="address">
|
||||
{% if address.isNoAddress == true %}
|
||||
<div class="chill_address_is_noaddress">{{ 'address.consider homeless'|trans }}</div>
|
||||
{% else %}
|
||||
{{ address|chill_entity_render_box({
|
||||
'multiline': false, 'with_valid_from': false
|
||||
}) }}
|
||||
{% endif %}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="date">01 janvier 1970</div>
|
||||
{# END TEST #}
|
||||
|
||||
</div>
|
||||
{# endif #}
|
||||
|
||||
<div class="col-b"></div>
|
||||
|
||||
{# if household address #}{#
|
||||
<div class="col-c content rowXX">
|
||||
<div class="address">...</div>
|
||||
</div>
|
||||
#}{# endif #}
|
||||
|
||||
<div class="date">
|
||||
{% if address.validFrom is not empty %}
|
||||
{{ address.validFrom|format_date('long') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('chill_person_view', { 'person_id' : person.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the person details'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-create"
|
||||
href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
|
||||
{{ 'Add an address'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{# TEST HOUSEHOLD POSITION
|
||||
#}
|
||||
<div class="col-b"></div>
|
||||
<div class="col-c content fake">
|
||||
<div class="address">
|
||||
<div class="street">
|
||||
<span class="streetNumber">549, chemin De Sousa</span>
|
||||
<span class="streetNumber">, 45, boulevard Aurore Roux</span>
|
||||
</div>
|
||||
<div class="postCode">
|
||||
<span>10850</span> <span>Nanterre</span> <span class="country">(France)</span>
|
||||
</div>
|
||||
<ul class="record_actions"><li><a href="" class="btn btn-edit"></a></li></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="date">01 janvier 1970</div>
|
||||
{# END TEST #}
|
||||
|
||||
</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('chill_person_view', { 'person_id' : person.id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the person details'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-create"
|
||||
href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
|
||||
{{ 'Add an address'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -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:
|
||||
<dt>{{ 'Address'|trans }}</dt>
|
||||
<dd>
|
||||
{%- if person.lastAddress is not empty -%}
|
||||
{{ address._render(person.lastAddress, {'has_no_address': true}) }}
|
||||
{{ person.lastAddress|chill_entity_render_box({'has_no_address': true}) }}
|
||||
|
||||
<ul class="list-inline text-right mt-2">
|
||||
<li class="list-inline-item">
|
||||
|
@ -1,7 +1,5 @@
|
||||
{%- macro details(person, options) -%}
|
||||
|
||||
{% import '@ChillMain/Address/macro.html.twig' as address %}
|
||||
|
||||
<ul>
|
||||
<li><b>{{ 'gender'|trans }}</b>:
|
||||
{{ person.gender|trans }}</li>
|
||||
@ -24,7 +22,9 @@
|
||||
<li><b>{{ 'memo'|trans }}</b>:
|
||||
{{ person.memo }}</li>
|
||||
<li><b>{{ 'address'|trans }}</b>:
|
||||
{%- if person.lastAddress is not empty -%}{{ address._render(person.lastAddress, {'with_valid_from': false}) }}{% endif %}</li>
|
||||
{%- if person.lastAddress is not empty -%}
|
||||
{{ person.lastAddress|chill_entity_render_box({'with_valid_from': false}) }}
|
||||
{% endif %}</li>
|
||||
<li><b>{{ 'spokenLanguages'|trans }}</b>:
|
||||
{% for lang in person.spokenLanguages %}{{ lang.name|localize_translatable_string }}{% if not loop.last %},{% endif %}{% endfor %}</li>
|
||||
<li><b>{{ 'contactInfo'|trans }}</b>:
|
||||
@ -43,4 +43,4 @@
|
||||
<li><b>{{ person.counters.nb_addresses }}</b> {{ (person.counters.nb_addresses > 1)? 'adresses' : 'adresse' }}</li>
|
||||
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
{% endmacro %}
|
||||
|
@ -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 .= '<span class="chill-entity__person__alt-name chill-entity__person__altname--'.$altName->getKey().'">';
|
||||
$str .= '<span class="altname altname-'.$altName->getKey().'">';
|
||||
}
|
||||
$str .= $altName->getLabel();
|
||||
|
||||
|
@ -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 %}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
{% else %}
|
||||
{{ address._render(thirdParty.address, {'with_valid_from': false }) }}
|
||||
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false }) }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user