mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
notification show page: use macro to display thread comments
This commit is contained in:
@@ -12,10 +12,25 @@
|
||||
{{ encore_entry_link_tags('mod_notification_toggle_read_status') }}
|
||||
{% endblock %}
|
||||
|
||||
{% import '@ChillPerson/AccompanyingCourse/Comment/macro_showItem.html.twig' as m %}
|
||||
|
||||
{% macro recordAction(comment) %}
|
||||
{% if is_granted('CHILL_MAIN_NOTIFICATION_COMMENT_EDIT', comment) %}
|
||||
<li>
|
||||
<a href="{{ chill_path_forward_return_path('chill_main_notification_show', {
|
||||
'_fragment': 'comment-' ~ comment.id,
|
||||
'edit': comment.id,
|
||||
'id': comment.notification.id
|
||||
}) }}" class="btn btn-edit" title="{{ 'Edit'|trans }}"
|
||||
></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-10 notification notification-show">
|
||||
|
||||
<h1 class="visually-hidden">{{ notification.title }}</h1>
|
||||
<h1>{{ 'notification.Notification'|trans }}</h1>
|
||||
|
||||
<div class="flex-table">
|
||||
{% include 'ChillMainBundle:Notification:_list_item.html.twig' with {
|
||||
@@ -27,72 +42,63 @@
|
||||
} %}
|
||||
</div>
|
||||
|
||||
{#
|
||||
{{ dump() }}
|
||||
<div>
|
||||
{% include handler.getTemplate(notification) with handler.getTemplateData(notification) %}
|
||||
</div>
|
||||
<div>
|
||||
à remplacer par un commentEmbeddable
|
||||
{{ notification.message|chill_markdown_to_html }}
|
||||
</div>
|
||||
#}
|
||||
<div class="notification-comment-list my-5">
|
||||
<h2 class="chill-blue">{{ 'notification.comments_list'|trans }}</h2>
|
||||
|
||||
<div class="comments thread m-5">
|
||||
{% if notification.comments|length > 0 %}
|
||||
{% for comment in notification.comments %}
|
||||
{% if editedCommentForm is null or editedCommentId != comment.id %}
|
||||
<div>
|
||||
<a id="comment-{{ comment.id }}"></a>
|
||||
<blockquote class="chill-user-quote">
|
||||
{{ comment.content|chill_markdown_to_html }}
|
||||
</blockquote>
|
||||
<div class="flex-table">
|
||||
{% for comment in notification.comments %}
|
||||
|
||||
{% if is_granted('CHILL_MAIN_NOTIFICATION_COMMENT_EDIT', comment) %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ chill_path_forward_return_path('chill_main_notification_show', { '_fragment': 'comment-'~comment.id, 'edit': comment.id, 'id': notification.id }) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div>
|
||||
<a id="comment-{{ comment.id }}"></a>
|
||||
{{ form_start(editedCommentForm) }}
|
||||
{{ form_widget(editedCommentForm) }}
|
||||
{% if editedCommentForm is null or editedCommentId != comment.id %}
|
||||
{{ m.show_comment(comment, {
|
||||
'recordAction': _self.recordAction(comment)
|
||||
}) }}
|
||||
{% else %}
|
||||
<div class="item-bloc">
|
||||
<div class="item-row row">
|
||||
<a id="comment-{{ comment.id }}"></a>
|
||||
|
||||
<input type="hidden" name="form" value="edit" />
|
||||
{{ form_start(editedCommentForm) }}
|
||||
{{ form_errors(editedCommentForm) }}
|
||||
{{ form_widget(editedCommentForm.content) }}
|
||||
<input type="hidden" name="form" value="edit" />
|
||||
<ul class="record_actions">
|
||||
<li class="cancel">
|
||||
<a href="{{ chill_path_forward_return_path('chill_main_notification_show', {
|
||||
'_fragment': 'comment-' ~ comment.id,
|
||||
'id': notification.id }) }}" class="btn btn-cancel">
|
||||
{{ 'cancel'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(editedCommentForm) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li class="cancel">
|
||||
<a href="{{ chill_path_forward_return_path('chill_main_notification_show', { '_fragment': 'comment-'~comment.id, 'id': notification.id }) }}" class="btn btn-cancel"></a>
|
||||
</li>
|
||||
<li>
|
||||
<button type="submit" class="btn btn-save"></button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(editedCommentForm) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if appendCommentForm is not null %}
|
||||
<div>
|
||||
{{ form_start(appendCommentForm) }}
|
||||
{{ form_widget(appendCommentForm) }}
|
||||
|
||||
<input type="hidden" name="form" value="append" />
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-save">{{ 'notification.append_comment'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(appendCommentForm) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="new-comment my-5">
|
||||
<h2 class="chill-blue">{{ 'Write a new comment'|trans }}</h2>
|
||||
|
||||
{{ form_start(appendCommentForm) }}
|
||||
{{ form_errors(appendCommentForm) }}
|
||||
{{ form_widget(appendCommentForm.content) }}
|
||||
<input type="hidden" name="form" value="append" />
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button class="btn btn-create" type="submit">{{ 'notification.append_comment'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(appendCommentForm) }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
|
Reference in New Issue
Block a user