From 4cac5f9a4ad7141110114f9cc1a8dded4a446557 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 30 Jul 2021 10:46:16 +0200 Subject: [PATCH] render_box: adding option addId + styles more generic, less specific --- .../Resources/public/chill/chillmain.scss | 7 +--- .../public/chill/scss/render_box.scss | 36 ++++++++++++++++-- .../public/chill/scss/render_box.scss | 24 +++--------- .../Resources/views/Entity/person.html.twig | 6 +++ .../Resources/views/Person/banner.html.twig | 37 +++++++------------ .../Templating/Entity/PersonRender.php | 1 + .../{thirdparty.scss => chillthirdparty.scss} | 23 ++---------- .../Resources/public/chill/index.js | 2 +- .../views/Entity/thirdparty.html.twig | 6 +++ .../Templating/Entity/ThirdPartyRender.php | 1 + 10 files changed, 71 insertions(+), 72 deletions(-) rename src/Bundle/ChillThirdPartyBundle/Resources/public/chill/{thirdparty.scss => chillthirdparty.scss} (74%) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index 70c4d3c0f..455b7a590 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -21,12 +21,7 @@ // styles communs pour tous les bandeaux div.banner { - .id-number { - font-weight: lighter; - font-size: 50%; - &:before { content: '(n°'; } - &:after { content: ')'; } - } + a.phone, a.email { color: white; diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss index 5e221507e..b2b15447b 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/render_box.scss @@ -2,7 +2,7 @@ section.chill-entity { // display inline for render raw - // have no effect for render label, row, bloc ! + // have no effect for render label, bloc ! display: inline; // don't break flex cascade with section tag @@ -13,8 +13,38 @@ section.chill-entity { } // specific rules -// address render_box -div.chill-entity { +.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 &.entity-address { div.noaddress {} div.address { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss index a68b10c0b..657129644 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/scss/render_box.scss @@ -1,22 +1,8 @@ - -section.chill-entity.entity-person { - div.entity-label { - div.denomination { - &.h3 { - 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 {} +section.chill-entity { + &.entity-person { + span.firstname, + span.lastname, + span.altname {} } - div.entity-row {} - div.entity-bloc {} } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 3d00fe0ea..4bda7db4d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -5,6 +5,7 @@ * addAltNames bool * addLink bool * addEntity bool + * addId bool * addInfo bool * hLevel integer * customButtons [ @@ -42,6 +43,11 @@ {%- if options['addEntity'] -%} {{ 'Person'|trans }} {%- endif -%} + {%- if options['addId'] -%} + + {{ person.id|upper }} + + {%- endif -%} {%- if options['addInfo'] -%} {% set gender = (person.gender == 'woman') ? 'fa-venus' : diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig index dd136014e..5389edb85 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/banner.html.twig @@ -2,26 +2,17 @@
- +
-

- {% set gender = - (person.gender == "woman") ? 'female' : - (person.gender == "both") ? 'neuter' : 'male' - %} - - - {{ person|chill_entity_render_string }} - - - {{ person.id|upper }} - -

+ {{ person|chill_entity_render_box({ + 'render': 'label', 'addInfo': true, 'addId': true, 'hLevel': 1 + }) }} +
- +
- +
{{ 'Birthdate'|trans|upper }}   : @@ -81,7 +72,7 @@ {{ person.age ~ ((person.age > 1) ? ' ans' : ' an') }}
- + {%- if chill_person.fields.nationality == 'visible' -%}
@@ -94,16 +85,16 @@ {% endif %}
{%- endif -%} - + {%- if chill_person.fields.spoken_languages == 'visible' -%}
{{ 'Center'|trans|upper}}   : - + {{ person.center.name|upper }}
{%- endif -%} - +
diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 603aa91ee..2b66f7581 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -55,6 +55,7 @@ class PersonRender extends AbstractChillEntityRender 'addAltNames' => $this->configAltNamesHelper->hasAltNames(), 'addLink' => $options['addLink'] ?? false, 'addEntity' => $options['addEntity'] ?? false, + 'addId' => $options['addId'] ?? false, 'addInfo' => $options['addInfo'] ?? false, 'hLevel' => $options['hLevel'] ?? 3, 'customButtons' => $options['customButtons'] ?? [], diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss similarity index 74% rename from src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss rename to src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss index b744f7edc..4ce6956c3 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/thirdparty.scss +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/chillthirdparty.scss @@ -1,26 +1,9 @@ /// render_box -section.chill-entity.entity-thirdparty { - div.entity-label { - div.denomination { - &.h3 { - font-size: 1.3em; - font-weight: 700; - } - a { - text-decoration: none; - } - span.name {} - span.badge { - margin-left: 0.3em; - } - } - p.moreinfo { - span.company, span.acronym {} - } +section.chill-entity { + .entity-thirdparty { + span.name {} } - div.entity-row {} - div.entity-bloc {} } /* AVANT diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/index.js b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/index.js index 0f6a3d5d8..d85b125aa 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/index.js +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/chill/index.js @@ -1,2 +1,2 @@ -require('./thirdparty.scss'); +require('./chillthirdparty.scss'); diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig index 49299bfaf..3ec20aba9 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig +++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/Entity/thirdparty.html.twig @@ -5,6 +5,7 @@ * with_valid_from bool * addLink bool * addEntity bool + * addId bool * addInfo bool * hLevel integer * customButtons [ @@ -32,6 +33,11 @@ {%- if options['addEntity'] -%} {{ 'Third party'|trans }} {%- endif -%} + {%- if options['addId'] -%} + + {{ person.id|upper }} + + {%- endif -%} {%- if options['addInfo'] -%}

{# diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php index 346c4dcc3..07f6e1668 100644 --- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php +++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php @@ -50,6 +50,7 @@ class ThirdPartyRender extends AbstractChillEntityRender 'with_valid_from' => $options['with_valid_from'] ?? true, 'addLink' => $options['addLink'] ?? false, 'addEntity' => $options['addEntity'] ?? false, + 'addId' => $options['addId'] ?? false, 'addInfo' => $options['addInfo'] ?? false, 'hLevel' => $options['hLevel'] ?? 3, 'customButtons' => $options['customButtons'] ?? [],