refund extension_list_notification template: change place and content

This commit is contained in:
Mathieu Jaumotte 2022-01-23 17:07:08 +01:00
parent 1a2e1eaf2a
commit ab23290599
5 changed files with 56 additions and 28 deletions

View File

@ -181,6 +181,14 @@
</div>
</div>
<div class="notification notification-list">
{% set notifications = chill_list_notifications('Chill\\ActivityBundle\\Entity\\Activity', entity.id) %}
{% if notifications is not empty %}
{{ notifications|raw }}
{% endif %}
</div>
{% set person_id = null %}
{% if person %}
{% set person_id = person.id %}
@ -197,18 +205,22 @@
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
<a class="btn btn-primary" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}">
<i class="fa fa-paper-plane fa-fw"></i>
{{ 'notification.Notify'|trans }}
</a>
</li>
{% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %}
<li>
<a class="btn btn-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
{{ 'Edit'|trans }}
</a>
<a href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
class="btn btn-update" title="{{ 'Edit'|trans }}"></a>
</li>
{% endif %}
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
<li>
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete">
{{ 'Delete'|trans }}
</a>
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
class="btn btn-delete" title="{{ 'Delete'|trans }}"></a>
</li>
{% endif %}
</ul>

View File

@ -25,19 +25,5 @@
{% endblock content %}
{% block block_post_menu %}
<div class="post-menu pt-4">
<div class="d-grid gap-2">
<a class="btn btn-primary" href="{{ chill_path_add_return_path('chill_main_notification_create', {'entityClass': 'Chill\\ActivityBundle\\Entity\\Activity', 'entityId': entity.id}) }}">
<i class="fa fa-paper-plane fa-fw"></i>
{{ 'notification.Notify'|trans }}
</a>
</div>
{% set notifications = chill_list_notifications('Chill\\ActivityBundle\\Entity\\Activity', entity.id) %}
{% if notifications is not empty %}
{{ notifications|raw }}
{% endif %}
</div>
<div class="post-menu pt-4"></div>
{% endblock %}

View File

@ -52,9 +52,11 @@
{% macro content(c) %}
<div class="item-row separator">
{% if c.data is defined %}
<div class="mx-3 flex-grow-1">
{% include c.data.template with c.data.template_data %}
</div>
{% endif %}
</div>
<div class="item-row">
<div class="notification-content">
@ -107,15 +109,25 @@
<button type="button" class="accordion-button collapsed"
data-bs-toggle="collapse" data-bs-target="#flush-collapse-{{ notification.id }}"
aria-expanded="false" aria-controls="flush-collapse-{{ notification.id }}">
{{ _self.title(_context) }}
</button>
{{ _self.header(_context) }}
</div>
<div id="flush-collapse-{{ notification.id }}"
class="accordion-collapse collapse"
aria-labelledby="flush-heading-{{ notification.id }}"
data-bs-parent="#notification-fold">
{{ _self.content(_context) }}
{% if with_folded_comments is defined and with_folded_comments != false %}
</div>{# close previous flex-table and reopen it after #}
{% include 'ChillMainBundle:Notification:_item_comments.html.twig' %}
<div class="flex-table">
{% endif %}
</div>
{% else %}
{{ _self.title(_context) }}

View File

@ -1,8 +1,24 @@
<h2>{{ 'notification.Notification'|trans }}</h2>
<div class="flex-table accordion accordion-flush" id="notification-fold">
{% for notification in notifications %}
{% include 'ChillMainBundle:Notification:_list_item.html.twig' with {
'action_button': false,
'full_content': true,
'fold_item': true,
} %}{#
DISABLED
'with_folded_comments': true
#}
{% endfor %}
</div>
{#
<div class="list-group my-2 notification notification-box">
<div class="list-group-item">
<h4>{{ 'notification.Sent'|trans }}</h4>
</div>
{# TODO pagination or limit #}
{% for notification in notifications %}
<div class="list-group-item notification-status {% if notification.isReadBy(app.user) %}read{% else %}unread{% endif %}">
@ -13,7 +29,7 @@
<abbr title="{{ 'Le ' ~ notification.date|format_date('long') ~ '\n' ~ notification.title }}">
{{ notification.date|format_datetime('short','short') }}
</abbr>
{# Vue component #}
<span class="notification_toggle_read_status"
data-notification-id="{{ notification.id }}"
data-notification-current-is-read="{{ notification.isReadBy(app.user) }}"
@ -44,3 +60,4 @@
</div>
{% endfor %}
</div>
#}

View File

@ -26,7 +26,8 @@
'template_data': handler.getTemplateData(notification)
},
'action_button': false,
'full_content': true
'full_content': true,
'fold_item': false
} %}
</div>