concernedGroups display badges as clickable onthefly modal

This commit is contained in:
Mathieu Jaumotte 2021-12-10 12:06:23 +01:00
parent 97165c8389
commit 95caa998e3
2 changed files with 32 additions and 38 deletions

View File

@ -3,6 +3,14 @@
{{ path(pathname, parms) }} {{ path(pathname, parms) }}
{% endmacro %} {% endmacro %}
{% macro insert_onthefly(type, entity) %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true,
targetEntity: { name: type, id: entity.id },
buttonText: entity|chill_entity_render_string
} %}
{% endmacro %}
{% macro computeWidth(nbBlocks) %} {% macro computeWidth(nbBlocks) %}
{{ 'flex-basis: ' ~ (100 / nbBlocks)|round(1) ~ '%;' }} {{ 'flex-basis: ' ~ (100 / nbBlocks)|round(1) ~ '%;' }}
{% endmacro %} {% endmacro %}
@ -13,6 +21,7 @@
{% set blocks = blocks|merge([{ {% set blocks = blocks|merge([{
'title': 'Others persons'|trans, 'title': 'Others persons'|trans,
'items': entity.persons, 'items': entity.persons,
'type': 'person',
'path' : 'chill_person_view', 'path' : 'chill_person_view',
'key' : 'person_id' 'key' : 'person_id'
}]) %} }]) %}
@ -20,11 +29,13 @@
{% set blocks = blocks|merge([{ {% set blocks = blocks|merge([{
'title': 'Persons in accompanying course'|trans, 'title': 'Persons in accompanying course'|trans,
'items': entity.personsAssociated, 'items': entity.personsAssociated,
'type': 'person',
'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,
'type': 'person',
'path' : 'chill_person_view', 'path' : 'chill_person_view',
'key' : 'person_id', 'key' : 'person_id',
}]) %} }]) %}
@ -34,6 +45,7 @@
{% set blocks = blocks|merge([{ {% set blocks = blocks|merge([{
'title': 'Third parties'|trans, 'title': 'Third parties'|trans,
'items': entity.thirdParties, 'items': entity.thirdParties,
'type': 'thirdparty',
'path' : 'chill_crud_3party_3party_view', 'path' : 'chill_crud_3party_3party_view',
'key' : 'id', 'key' : 'id',
}]) %} }]) %}
@ -42,6 +54,7 @@
{% set blocks = blocks|merge([{ {% set blocks = blocks|merge([{
'title': 'Users concerned'|trans, 'title': 'Users concerned'|trans,
'items': entity.users, 'items': entity.users,
'type': 'user',
'key' : 'id', 'key' : 'id',
}]) %} }]) %}
{% endif %} {% endif %}
@ -59,22 +72,12 @@
<ul class="list-content"> <ul class="list-content">
{% for item in bloc.items %} {% for item in bloc.items %}
<li> <li>
{% if bloc.path is defined %} {% if bloc.type == 'user' %}
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}"> <span class="badge-user">
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}"> {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
</span> </span>
</a>
{% else %} {% else %}
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}"> {{ _self.insert_onthefly(bloc.type, item) }}
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
</span>
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}
@ -96,20 +99,12 @@
<ul class="list-content"> <ul class="list-content">
{% for item in bloc.items %} {% for item in bloc.items %}
<li> <li>
{% if bloc.path is defined %} {% if bloc.type == 'user' %}
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}"> <span class="badge-user">
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}"> {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
</span> </span>
</a>
{% else %} {% else %}
{{ item|chill_entity_render_box({ {{ _self.insert_onthefly(bloc.type, item) }}
'render': 'raw',
'addAltNames': false
}) }}
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}
@ -131,19 +126,13 @@
<div class="wl-col list"> <div class="wl-col list">
{% for item in bloc.items %} {% for item in bloc.items %}
<span class="wl-item {% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}"> <span class="wl-item">
{% if bloc.path is defined %} {% if bloc.type == 'user' %}
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}"> <span class="badge-user">
{{ item|chill_entity_render_box({ {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
'render': 'raw', </span>
'addAltNames': false
}) }}
</a>
{% else %} {% else %}
{{ item|chill_entity_render_box({ {{ _self.insert_onthefly(bloc.type, item) }}
'render': 'raw',
'addAltNames': false
}) }}
{% endif %} {% endif %}
</span> </span>

View File

@ -2,6 +2,7 @@
* BADGES PERSON AND THIRDPARTY * BADGES PERSON AND THIRDPARTY
*/ */
span.badge-user,
span.badge-person, span.badge-person,
span.badge-thirdparty { span.badge-thirdparty {
display: inline-block; display: inline-block;
@ -16,6 +17,10 @@ span.badge-thirdparty {
text-decoration: none; text-decoration: none;
} }
} }
span.badge-user {
border-bottom-width: 1px;
}
span.badge-person { span.badge-person {
border-bottom-color: $chill-green; border-bottom-color: $chill-green;
} }