mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-30 22:16:14 +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 }}
|
||||
{% endblock %}
|
||||
|
||||
{% 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 %}
|
||||
{% import '@ChillPerson/AccompanyingCourse/Comment/macro_showItem.html.twig' as macro %}
|
||||
|
||||
{% macro form_comment(type, form) %}
|
||||
{% if type == 'edit' %}
|
||||
@ -73,14 +38,14 @@
|
||||
{% if commentEditId == accompanyingCourse.pinnedComment.id %}
|
||||
{{ _self.form_comment('edit', edit_form) }}
|
||||
{% else %}
|
||||
{{ _self.show_comment(accompanyingCourse.pinnedComment, {'pinned': 'true'}) }}
|
||||
{{ macro.show_comment(accompanyingCourse.pinnedComment, {'pinned': 'true'}) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% for c in accompanyingCourse.comments %}
|
||||
{% if commentEditId == c.id %}
|
||||
{{ _self.form_comment('edit', edit_form) }}
|
||||
{% else %}
|
||||
{{ _self.show_comment(c) }}
|
||||
{{ macro.show_comment(c) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</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