mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
inject record_actions buttons inside macro
This commit is contained in:
parent
c60d46c68b
commit
69b5c98d2e
@ -4,7 +4,28 @@
|
||||
{{ 'Accompanying Course Comment list'|trans }}
|
||||
{% endblock %}
|
||||
|
||||
{% import '@ChillPerson/AccompanyingCourse/Comment/macro_showItem.html.twig' as macro %}
|
||||
{% import '@ChillPerson/AccompanyingCourse/Comment/macro_showItem.html.twig' as m %}
|
||||
|
||||
{% macro recordAction(comment, isPinned) %}
|
||||
{% if isPinned is defined and isPinned == 'true' %}
|
||||
{% else %}
|
||||
<li>
|
||||
<button class="btn btn-sm btn-misc" type="button">
|
||||
<i class="fa fa-flag fa-fw"></i>{{ 'Pin comment'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
<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>
|
||||
<li>
|
||||
<a class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}" href=""></a>
|
||||
</li>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro form_comment(type, form) %}
|
||||
{% if type == 'edit' %}
|
||||
@ -38,14 +59,19 @@
|
||||
{% if commentEditId == accompanyingCourse.pinnedComment.id %}
|
||||
{{ _self.form_comment('edit', edit_form) }}
|
||||
{% else %}
|
||||
{{ macro.show_comment(accompanyingCourse.pinnedComment, {'pinned': 'true'}) }}
|
||||
{{ m.show_comment(accompanyingCourse.pinnedComment, {
|
||||
'pinned': 'true',
|
||||
'recordAction': _self.recordAction(accompanyingCourse.pinnedComment, 'true')
|
||||
}) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% for c in accompanyingCourse.comments %}
|
||||
{% if commentEditId == c.id %}
|
||||
{% for comment in accompanyingCourse.comments %}
|
||||
{% if commentEditId == comment.id %}
|
||||
{{ _self.form_comment('edit', edit_form) }}
|
||||
{% else %}
|
||||
{{ macro.show_comment(c) }}
|
||||
{{ m.show_comment(comment, {
|
||||
'recordAction': _self.recordAction(comment)
|
||||
}) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -5,28 +5,16 @@
|
||||
{% if options.pinned is defined %}
|
||||
<i class="fa fa-flag fa-fw fa-lg" title="{{ 'pinned'|trans }}"></i>
|
||||
{% endif %}
|
||||
<a id="comment{{ comment.id }}" href="{{ '#comment' ~ comment.id }}" class="fa fa-pencil-square-o fa-fw"></a>
|
||||
{{ 'by'|trans }}<b>{{ comment.creator }}</b>{{ ', ' ~ 'on'|trans ~ ' ' ~ comment.createdAt|format_date('long') }}<br>
|
||||
<a id="comment-{{ comment.id }}" href="{{ '#comment-' ~ comment.id }}" class="fa fa-pencil-square-o fa-fw"></a>
|
||||
|
||||
{% set creator = comment.creator is defined ? comment.creator : comment.createdBy %}
|
||||
{{ 'by'|trans }}<b>{{ creator }}</b>
|
||||
|
||||
{{ ', ' ~ 'on'|trans ~ ' ' ~ comment.createdAt|format_date('long') }}<br>
|
||||
<i>{{ 'Last updated on'|trans ~ ' ' ~ comment.updatedAt|format_datetime('long', 'short') }}</i>
|
||||
</div>
|
||||
<ul class="record_actions">
|
||||
{% if options.pinned is not defined %}
|
||||
<li>
|
||||
<button class="btn btn-sm btn-misc" type="button">
|
||||
<i class="fa fa-flag fa-fw"></i>
|
||||
{{ 'Pin comment'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a class="btn btn-sm btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_person_accompanying_period_comment_list', {
|
||||
'accompanying_period_id': comment.accompanyingPeriod.id,
|
||||
'edit': comment.id
|
||||
}) ~ '#comment' ~ comment.id }}"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-sm btn-delete" title="{{ 'Delete'|trans }}" href=""></a>
|
||||
</li>
|
||||
{{ options.recordAction }}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="item-row separator">
|
||||
|
Loading…
x
Reference in New Issue
Block a user