mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
concernedGroups.html.twig check if block isVisible, count block and adjust width
This commit is contained in:
parent
ccff346dbb
commit
be71decee5
@ -3,89 +3,93 @@
|
|||||||
{{ path(pathname, parms) }}
|
{{ path(pathname, parms) }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% if context == 'person' %}
|
{% macro computeWidth(nbBlocks) %}
|
||||||
{% set blocs = [
|
{{ 'flex-basis: ' ~ (100 / nbBlocks)|round(1) ~ '%;' }}
|
||||||
{ 'title': 'Others persons'|trans,
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% set blocks = [] %}
|
||||||
|
{% if entity.activityType.personsVisible %}
|
||||||
|
{% if context == 'person' %}
|
||||||
|
{% set blocks = blocks|merge([{
|
||||||
|
'title': 'Others persons'|trans,
|
||||||
'items': entity.persons,
|
'items': entity.persons,
|
||||||
'path' : 'chill_person_view',
|
'path' : 'chill_person_view',
|
||||||
'key' : 'person_id'
|
'key' : 'person_id'
|
||||||
},
|
}]) %}
|
||||||
{ 'title': 'Third parties'|trans,
|
{% else %}
|
||||||
'items': entity.thirdParties,
|
{% set blocks = blocks|merge([{
|
||||||
'path' : 'chill_crud_3party_3party_view',
|
'title': 'Persons in accompanying course'|trans,
|
||||||
'key' : 'id'
|
|
||||||
},
|
|
||||||
{ 'title': 'Users concerned'|trans,
|
|
||||||
'items': entity.users,
|
|
||||||
'key' : 'id'
|
|
||||||
},
|
|
||||||
] %}
|
|
||||||
{% else %}
|
|
||||||
{% set blocs = [
|
|
||||||
{ 'title': 'Persons in accompanying course'|trans,
|
|
||||||
'items': entity.personsAssociated,
|
'items': entity.personsAssociated,
|
||||||
'path' : 'chill_person_view',
|
'path' : 'chill_person_view',
|
||||||
'key' : 'person_id'
|
'key' : 'person_id'
|
||||||
},
|
},{
|
||||||
{ 'title': 'Third persons'|trans,
|
'title': 'Third persons'|trans,
|
||||||
'items': entity.personsNotAssociated,
|
'items': entity.personsNotAssociated,
|
||||||
'path' : 'chill_person_view',
|
'path' : 'chill_person_view',
|
||||||
'key' : 'person_id'
|
'key' : 'person_id',
|
||||||
},
|
}]) %}
|
||||||
{ 'title': 'Third parties'|trans,
|
{% endif %}
|
||||||
'items': entity.thirdParties,
|
{% endif %}
|
||||||
'path' : 'chill_crud_3party_3party_view',
|
{% if entity.activityType.thirdPartiesVisible %}
|
||||||
'key' : 'id'
|
{% set blocks = blocks|merge([{
|
||||||
},
|
'title': 'Third parties'|trans,
|
||||||
{ 'title': 'Users concerned'|trans,
|
'items': entity.thirdParties,
|
||||||
'items': entity.users,
|
'path' : 'chill_crud_3party_3party_view',
|
||||||
'key' : 'id'
|
'key' : 'id',
|
||||||
},
|
}]) %}
|
||||||
] %}
|
{% endif %}
|
||||||
|
{% if entity.activityType.usersVisible %}
|
||||||
|
{% set blocks = blocks|merge([{
|
||||||
|
'title': 'Users concerned'|trans,
|
||||||
|
'items': entity.users,
|
||||||
|
'key' : 'id',
|
||||||
|
}]) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (with_display == 'bloc') %}
|
{% if (with_display == 'bloc') %}
|
||||||
<div class="{{ context }} flex-bloc concerned-groups">
|
<div class="{{ context }} flex-bloc concerned-groups">
|
||||||
{% for bloc in blocs %}
|
{% for bloc in blocks %}
|
||||||
<div class="item-bloc">
|
|
||||||
<div class="item-row">
|
<div class="item-bloc" style="{{ _self.computeWidth(loop.length) }}">
|
||||||
<div class="item-col">
|
<div class="item-row">
|
||||||
<h4>{{ bloc.title }}</h4>
|
<div class="item-col">
|
||||||
</div>
|
<h4>{{ bloc.title }}</h4>
|
||||||
<div class="item-col">
|
</div>
|
||||||
<ul class="list-content">
|
<div class="item-col">
|
||||||
{% for item in bloc.items %}
|
<ul class="list-content">
|
||||||
<li>
|
{% for item in bloc.items %}
|
||||||
{% if bloc.path is defined %}
|
<li>
|
||||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
{% if bloc.path is defined %}
|
||||||
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||||
{{ item|chill_entity_render_box({
|
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||||
'render': 'raw',
|
{{ item|chill_entity_render_box({
|
||||||
'addAltNames': false
|
'render': 'raw',
|
||||||
}) }}
|
'addAltNames': false
|
||||||
</span>
|
}) }}
|
||||||
</a>
|
</span>
|
||||||
{% else %}
|
</a>
|
||||||
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
{% else %}
|
||||||
{{ item|chill_entity_render_box({
|
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||||
'render': 'raw',
|
{{ item|chill_entity_render_box({
|
||||||
'addAltNames': false
|
'render': 'raw',
|
||||||
}) }}
|
'addAltNames': false
|
||||||
</span>
|
}) }}
|
||||||
{% endif %}
|
</span>
|
||||||
</li>
|
{% endif %}
|
||||||
{% endfor %}
|
</li>
|
||||||
</ul>
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (with_display == 'row') %}
|
{% if (with_display == 'row') %}
|
||||||
<div class="concerned-groups">
|
<div class="concerned-groups">
|
||||||
{% for bloc in blocs %}
|
{% for bloc in blocks %}
|
||||||
<div class="group">
|
<div class="group">
|
||||||
{% if bloc.items|length > 0 %}
|
{% if bloc.items|length > 0 %}
|
||||||
<h4>{{ bloc.title }}</h4>
|
<h4>{{ bloc.title }}</h4>
|
||||||
@ -118,7 +122,7 @@
|
|||||||
|
|
||||||
{% if (with_display == 'wrap-list') %}
|
{% if (with_display == 'wrap-list') %}
|
||||||
<div class="concerned-groups wrap-list">
|
<div class="concerned-groups wrap-list">
|
||||||
{% for bloc in blocs %}
|
{% for bloc in blocks %}
|
||||||
<div class="wl-row">
|
<div class="wl-row">
|
||||||
{% if bloc.items|length > 0 %}
|
{% if bloc.items|length > 0 %}
|
||||||
<div class="wl-col title">
|
<div class="wl-col title">
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
{% block content -%}
|
{% block content -%}
|
||||||
<div class="activity-show">
|
<div class="activity-show">
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
|
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user