render_box: adding option addId + styles more generic, less specific

This commit is contained in:
Mathieu Jaumotte 2021-07-30 10:46:16 +02:00
parent 6dac130844
commit 4cac5f9a4a
10 changed files with 71 additions and 72 deletions

View File

@ -21,12 +21,7 @@
// styles communs pour tous les bandeaux // styles communs pour tous les bandeaux
div.banner { div.banner {
.id-number {
font-weight: lighter;
font-size: 50%;
&:before { content: '(n°'; }
&:after { content: ')'; }
}
a.phone, a.phone,
a.email { a.email {
color: white; color: white;

View File

@ -2,7 +2,7 @@
section.chill-entity { section.chill-entity {
// display inline for render raw // display inline for render raw
// have no effect for render label, row, bloc ! // have no effect for render label, bloc !
display: inline; display: inline;
// don't break flex cascade with section tag // don't break flex cascade with section tag
@ -13,8 +13,38 @@ section.chill-entity {
} }
// specific rules // specific rules
.chill-entity {
// used for: entity-person, entity-thirdparty
&.entity-person,
&.entity-thirdparty {
div.entity-label {
div.denomination {
&.h3 {
font-size: 1.3em;
font-weight: 700;
}
a {
text-decoration: none;
}
span.badge {
margin-left: 0.3em;
}
span.id-number {
font-weight: lighter;
font-size: 50%;
margin-left: 0.5em;
&:before { content: '(n°'; }
&:after { content: ')'; }
}
}
p.moreinfo {}
}
div.entity-bloc {}
}
// address render_box // address render_box
div.chill-entity {
&.entity-address { &.entity-address {
div.noaddress {} div.noaddress {}
div.address { div.address {

View File

@ -1,22 +1,8 @@
section.chill-entity {
section.chill-entity.entity-person { &.entity-person {
div.entity-label { span.firstname,
div.denomination { span.lastname,
&.h3 { span.altname {}
font-size: 1.3em;
font-weight: 700;
} }
a {
text-decoration: none;
}
span.firstname, span.lastname, span.altname {}
span.badge {
margin-left: 0.3em;
}
}
p.moreinfo {}
}
div.entity-row {}
div.entity-bloc {}
} }

View File

@ -5,6 +5,7 @@
* addAltNames bool * addAltNames bool
* addLink bool * addLink bool
* addEntity bool * addEntity bool
* addId bool
* addInfo bool * addInfo bool
* hLevel integer * hLevel integer
* customButtons [ * customButtons [
@ -42,6 +43,11 @@
{%- if options['addEntity'] -%} {%- if options['addEntity'] -%}
<span class="badge rounded-pill bg-secondary">{{ 'Person'|trans }}</span> <span class="badge rounded-pill bg-secondary">{{ 'Person'|trans }}</span>
{%- endif -%} {%- endif -%}
{%- if options['addId'] -%}
<span class="id-number" title="{{ 'Person'|trans ~ ' ' ~ person.id }}">
{{ person.id|upper }}
</span>
{%- endif -%}
</div> </div>
{%- if options['addInfo'] -%} {%- if options['addInfo'] -%}
{% set gender = (person.gender == 'woman') ? 'fa-venus' : {% set gender = (person.gender == 'woman') ? 'fa-venus' :

View File

@ -4,19 +4,10 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h1> {{ person|chill_entity_render_box({
{% set gender = 'render': 'label', 'addInfo': true, 'addId': true, 'hLevel': 1
(person.gender == "woman") ? 'female' : }) }}
(person.gender == "both") ? 'neuter' : 'male'
%}
<i class="fa fa-fw fa-{{ gender }}" title="{{ gender|capitalize|trans }}"></i>
{{ person|chill_entity_render_string }}
<span class="id-number" title="{{ 'Person'|trans ~ ' ' ~ person.id }}">
{{ person.id|upper }}
</span>
</h1>
</div> </div>
<div class="col-md-auto ps-4 ps-md-2"> <div class="col-md-auto ps-4 ps-md-2">

View File

@ -55,6 +55,7 @@ class PersonRender extends AbstractChillEntityRender
'addAltNames' => $this->configAltNamesHelper->hasAltNames(), 'addAltNames' => $this->configAltNamesHelper->hasAltNames(),
'addLink' => $options['addLink'] ?? false, 'addLink' => $options['addLink'] ?? false,
'addEntity' => $options['addEntity'] ?? false, 'addEntity' => $options['addEntity'] ?? false,
'addId' => $options['addId'] ?? false,
'addInfo' => $options['addInfo'] ?? false, 'addInfo' => $options['addInfo'] ?? false,
'hLevel' => $options['hLevel'] ?? 3, 'hLevel' => $options['hLevel'] ?? 3,
'customButtons' => $options['customButtons'] ?? [], 'customButtons' => $options['customButtons'] ?? [],

View File

@ -1,27 +1,10 @@
/// render_box /// render_box
section.chill-entity.entity-thirdparty { section.chill-entity {
div.entity-label { .entity-thirdparty {
div.denomination {
&.h3 {
font-size: 1.3em;
font-weight: 700;
}
a {
text-decoration: none;
}
span.name {} span.name {}
span.badge {
margin-left: 0.3em;
} }
} }
p.moreinfo {
span.company, span.acronym {}
}
}
div.entity-row {}
div.entity-bloc {}
}
/* AVANT /* AVANT
border: 1px solid black; border: 1px solid black;

View File

@ -1,2 +1,2 @@
require('./thirdparty.scss'); require('./chillthirdparty.scss');

View File

@ -5,6 +5,7 @@
* with_valid_from bool * with_valid_from bool
* addLink bool * addLink bool
* addEntity bool * addEntity bool
* addId bool
* addInfo bool * addInfo bool
* hLevel integer * hLevel integer
* customButtons [ * customButtons [
@ -32,6 +33,11 @@
{%- if options['addEntity'] -%} {%- if options['addEntity'] -%}
<span class="badge rounded-pill bg-secondary">{{ 'Third party'|trans }}</span> <span class="badge rounded-pill bg-secondary">{{ 'Third party'|trans }}</span>
{%- endif -%} {%- endif -%}
{%- if options['addId'] -%}
<span class="id-number" title="{{ 'Third party'|trans ~ ' ' ~ thirdparty.id }}">
{{ person.id|upper }}
</span>
{%- endif -%}
</div> </div>
{%- if options['addInfo'] -%} {%- if options['addInfo'] -%}
<p class="moreinfo">{# <p class="moreinfo">{#

View File

@ -50,6 +50,7 @@ class ThirdPartyRender extends AbstractChillEntityRender
'with_valid_from' => $options['with_valid_from'] ?? true, 'with_valid_from' => $options['with_valid_from'] ?? true,
'addLink' => $options['addLink'] ?? false, 'addLink' => $options['addLink'] ?? false,
'addEntity' => $options['addEntity'] ?? false, 'addEntity' => $options['addEntity'] ?? false,
'addId' => $options['addId'] ?? false,
'addInfo' => $options['addInfo'] ?? false, 'addInfo' => $options['addInfo'] ?? false,
'hLevel' => $options['hLevel'] ?? 3, 'hLevel' => $options['hLevel'] ?? 3,
'customButtons' => $options['customButtons'] ?? [], 'customButtons' => $options['customButtons'] ?? [],