mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 14:36:13 +00:00
put macro show_comment in a separate template
This commit is contained in:
parent
be4b8a94f0
commit
c60d46c68b
@ -4,42 +4,7 @@
|
|||||||
{{ 'Accompanying Course Comment list'|trans }}
|
{{ 'Accompanying Course Comment list'|trans }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% macro show_comment(comment, options) %}
|
{% import '@ChillPerson/AccompanyingCourse/Comment/macro_showItem.html.twig' as macro %}
|
||||||
<div class="item-bloc">
|
|
||||||
<div class="item-row">
|
|
||||||
<div>
|
|
||||||
{% 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>
|
|
||||||
<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>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="item-row separator">
|
|
||||||
<blockquote class="chill-user-quote col">{{ comment.content|chill_markdown_to_html }}</blockquote>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
{% macro form_comment(type, form) %}
|
{% macro form_comment(type, form) %}
|
||||||
{% if type == 'edit' %}
|
{% if type == 'edit' %}
|
||||||
@ -73,14 +38,14 @@
|
|||||||
{% if commentEditId == accompanyingCourse.pinnedComment.id %}
|
{% if commentEditId == accompanyingCourse.pinnedComment.id %}
|
||||||
{{ _self.form_comment('edit', edit_form) }}
|
{{ _self.form_comment('edit', edit_form) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ _self.show_comment(accompanyingCourse.pinnedComment, {'pinned': 'true'}) }}
|
{{ macro.show_comment(accompanyingCourse.pinnedComment, {'pinned': 'true'}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for c in accompanyingCourse.comments %}
|
{% for c in accompanyingCourse.comments %}
|
||||||
{% if commentEditId == c.id %}
|
{% if commentEditId == c.id %}
|
||||||
{{ _self.form_comment('edit', edit_form) }}
|
{{ _self.form_comment('edit', edit_form) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ _self.show_comment(c) }}
|
{{ macro.show_comment(c) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
{% macro show_comment(comment, options) %}
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row">
|
||||||
|
<div>
|
||||||
|
{% 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>
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="item-row separator">
|
||||||
|
<blockquote class="chill-user-quote col">{{ comment.content|chill_markdown_to_html }}</blockquote>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
Loading…
x
Reference in New Issue
Block a user