mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 09:34:59 +00:00
93 lines
3.4 KiB
Twig
93 lines
3.4 KiB
Twig
{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %}
|
|
|
|
{% block title %}
|
|
{{ 'Accompanying Course Comment list'|trans }}
|
|
{% endblock %}
|
|
|
|
{% import '@ChillPerson/AccompanyingCourse/Comment/macro_showItem.html.twig' as m %}
|
|
|
|
{% macro recordAction(comment, isPinned) %}
|
|
{% if isPinned is defined and isPinned == true %}
|
|
{% else %}
|
|
<li>
|
|
<form method="post" action="{{ chill_path_forward_return_path('chill_person_accompanying_period_comment_pin', {'id': comment.id}) }}">
|
|
<button class="btn btn-sm btn-misc" type="submit">
|
|
<i class="fa fa-flag fa-fw"></i>{{ 'Pin comment'|trans }}
|
|
</button>
|
|
</form>
|
|
</li>
|
|
{% endif %}
|
|
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_EDIT', comment) %}
|
|
<li>
|
|
<a class="btn btn-sm btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_person_accompanying_period_comment_list', {
|
|
'_fragment': 'comment-' ~ comment.id,
|
|
'edit': comment.id,
|
|
'accompanying_period_id': comment.accompanyingPeriod.id
|
|
}) }}"></a>
|
|
</li>
|
|
{% endif %}
|
|
{% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_COMMENT_DELETE', comment) %}
|
|
<li>
|
|
<a class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}" href="{{ path('chill_person_accompanying_period_comment_delete', {'id': comment.id}) }}"></a>
|
|
</li>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro form_comment(type, form) %}
|
|
{% if type == 'edit' %}
|
|
<div class="item-bloc">
|
|
<div class="item-row row">
|
|
{% endif %}
|
|
{{ form_start(form) }}
|
|
{{ form_errors(form) }}
|
|
{{ form_widget(form.content) }}
|
|
<ul class="record_actions">
|
|
<li>
|
|
{% if type == 'new' %}
|
|
<button class="btn btn-create" type="submit">{{ 'Post a new comment'|trans }}</button>
|
|
{% elseif type == 'edit' %}
|
|
<button class="btn btn-save" type="submit">{{ 'Save'|trans }}</button>
|
|
{% endif %}
|
|
</li>
|
|
</ul>
|
|
{{ form_end(form) }}
|
|
{% if type == 'edit' %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% block content %}
|
|
<div class="accompanyingcourse-comment-list">
|
|
<h1>{{ block('title') }}</h1>
|
|
<div class="flex-table">
|
|
{% if accompanyingCourse.pinnedComment %}
|
|
{% if commentEditId == accompanyingCourse.pinnedComment.id %}
|
|
{{ _self.form_comment('edit', edit_form) }}
|
|
{% else %}
|
|
{{ m.show_comment(accompanyingCourse.pinnedComment, {
|
|
'pinned': true,
|
|
'recordAction': _self.recordAction(accompanyingCourse.pinnedComment, true)
|
|
}) }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% for comment in accompanyingCourse.comments %}
|
|
{% if commentEditId == comment.id %}
|
|
{{ _self.form_comment('edit', edit_form) }}
|
|
{% else %}
|
|
{{ m.show_comment(comment, {
|
|
'recordAction': _self.recordAction(comment)
|
|
}) }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if form is not null %}
|
|
<div class="new-comment my-5">
|
|
<h2 class="chill-blue">{{ 'Write a new comment'|trans }}</h2>
|
|
{{ _self.form_comment('new', form) }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|