redesign timeline with css gridlayout

This commit is contained in:
Mathieu Jaumotte 2021-06-23 19:21:49 +02:00
parent 2cc1274ee0
commit 1ceabec400
3 changed files with 204 additions and 188 deletions

View File

@ -130,89 +130,87 @@ div#header-household-details {
}
}
div.household__address,
div.person__address {
div.row {
height: 100px;
width: 100%;
/*
* ADDRESS HISTORY
* context person / household
*/
div.timeline.grid {
display: grid;
grid-template-rows: auto auto auto;
grid-template-columns: auto 120px auto;
@media only screen and (max-width: 750px) {
grid-template-columns: auto 1em auto;
}
div.top {
grid-column: 2;
text-align: center;
color: lightgrey;
margin-bottom: -20px;
}
div.col-a {
grid-column: 1;
text-align: right;
}
div.col-b,
div.date {
grid-column: 2;
position: relative;
& > div {
&:after {
position: absolute;
display: table;
content: '';
top: 0; bottom: 0;
left: 50%;
margin: auto -5px;
width: 10px;
height: 100%;
border: 1px dotted #c3c3c3;
background-color: lightgrey;
z-index: -5;
}
}
div.col-c {
grid-column: 3;
}
div.household__address--date,
div.person__address--date {
width: 30%;
background-color: #c3c3c3;
height: 100%;
div.cell {
box-sizing: border-box;
position: relative;
height: 100%;
width: 100%;
margin-left: 50%;
div.pill {
position: absolute;
box-sizing: border-box;
width: 120px;
height: 40px;
bottom: -20px;
background-color: white;
padding: 10px;
border-radius: 30px;
left: -60px;
text-align: center;
z-index: 10;
}
}
div.col-b,
div.action,
div.content {
min-height: 30px;
padding: 1em;
}
div.content {
box-shadow:
1px 0 0 0 #000,
0 1px 0 0 #000,
1px 1px 0 0 #000,
1px 0 0 0 #000 inset,
0 1px 0 0 #000 inset;
div.address {
font-variant: small-caps;
}
div.household__address--content,
div.person__address--content {
width: 70%;
left: 30%;
text-align: left;
background-color: #ececec;
border: 1px solid #888;
div.cell {
display: table-cell;
padding: 5px 30px;
vertical-align: middle;
& > div {
display: flex;
justify-content: space-between;
}
i.dot::after,
i.dot::before {
position: absolute;
width: 20px;
height: 20px;
content: '';
border: 0;
background-color: white;
border-radius: 50%;
border: 5px solid #c3c3c3;
z-index: 10;
left: -15px;
bottom: -15px;
}
}
}
div.date {
text-align: center;
background-color: lightgrey;
padding: 0.5em;
border-radius: 0.3em;
}
div.span2 { grid-row: span 3; }
div.span3 { grid-row: span 5; }
div.span4 { grid-row: span 7; }
div.span5 { grid-row: span 9; }
ul.record_actions {
margin: 0;
}
.fake {
&:after {
content: 'fake, just to test.. ';
color: lightgrey;
font-style: italic;
}
}
}
div.household__address-move {
div.household__address-move__create {
display: flex;
flex-direction: column;
}
}

View File

@ -25,68 +25,84 @@
{% block personcontent %}
<h1>{{ 'Addresses\'history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1>
<div class="person__address">
<div class="row">
<div class="person__address--date"></div>
<div class="person__address--content">
<div class="cell">
<div>
{% if person.addresses|length == 0 %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% endif %}
<a class="sc-button bt-create"
href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
{{ 'Add an address'|trans }}
</a>
</div>
</div>
</div>
</div>
<div class="person 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 %}
<div class="row">
<div class="person__address--date">
<div class="cell">
<div class="pill">
{% if address.validFrom is not empty %}
{{ address.validFrom|format_date('long') }}
{% endif %}
</div>
</div>
</div>
<div class="person__address--content">
<div class="cell">
<i class="dot"></i>
<div>
{% if address.isNoAddress == true %}
{# 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 %}
<div>
{% if address.street is not empty %}
<div class="street">
<i class="fa fa-fw fa-map-marker"></i>
<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>
{% 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 %}
<a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit"></a>
</div>
{% 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="sc-button bt-edit"></a>
</li>
</ul>
</div>
</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="sc-button bt-edit"></a></li></ul>
</div>
</div>
<div class="date">01 janvier 1970</div>
</div>
<ul class="record_actions">
@ -95,7 +111,12 @@
{{ 'Back to the person details'|trans }}
</a>
</li>
<li>
<a class="sc-button bt-create"
href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
{{ 'Add an address'|trans }}
</a>
</li>
</ul>
{% endblock personcontent %}

View File

@ -4,67 +4,64 @@
{% block content %}
<h1>{{ block('title') }}</h1>
<div class="household">
<div class="household__address">
<div class="household address">
<div class="row">
<div class="household__address--date"></div>
<div class="household__address--content">
<div class="cell">
<a class="sc-button bt-create"
href="{{ chill_path_add_return_path('chill_person_household_address_move', { 'household_id': household.id }) }}">
{{ 'Move household'|trans }}
</a>
</div>
<div class="row">
<div class="date"></div>
<div class="content">
<div class="cell">
<a class="sc-button bt-create"
href="{{ chill_path_add_return_path('chill_person_household_address_move', { 'household_id': household.id }) }}">
{{ 'Move household'|trans }}
</a>
</div>
</div>
{% for address in household.addresses %}
<div class="row">
<div class="household__address--date">
<div class="cell">
<div class="pill">
{% if address.validFrom is not empty %}
{{ address.validFrom|format_date('long') }}
{% endif %}
</div>
</div>
</div>
<div class="household__address--content">
<div class="cell">
<i class="dot"></i>
<div>
{% if address.isNoAddress == true %}
<div class="chill_address_is_noaddress">{{ 'address.consider homeless'|trans }}</div>
{% else %}
<div>
{% if address.street is not empty %}
<div class="street">
<i class="fa fa-fw fa-map-marker"></i>
<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 %}
</div>
{% endif %}
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit"></a>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% for address in household.addresses %}
<div class="row">
<div class="date">
<div class="cell">
<div class="pill">
{% if address.validFrom is not empty %}
{{ address.validFrom|format_date('long') }}
{% endif %}
</div>
</div>
</div>
<div class="content">
<div class="cell">
<i class="dot"></i>
<div>
{% if address.isNoAddress == true %}
<div class="chill_address_is_noaddress">{{ 'address.consider homeless'|trans }}</div>
{% else %}
<div>
{% if address.street is not empty %}
<div class="street">
<i class="fa fa-fw fa-map-marker"></i>
<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 %}
</div>
{% endif %}
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit"></a>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}