{% embed '@AdminLTE/Widgets/box-widget.html.twig' with {'form': form, 'comments': comments, 'route_pin': route_pin|default(null), 'route_delete': route_delete|default(null), 'delete_by_user': delete_by_user|default(false)} %} {% import "macros/widgets.html.twig" as widgets %} {% block box_title %}{{ 'label.comment'|trans }}{% endblock %} {% block box_attributes %}id="comments_box"{% endblock %} {% block box_body_class %}box-body-scrollable{% endblock %} {% block box_body %} {% set replacer = {} %} {% for pref in app.user.preferences %} {% set replacer = replacer|merge({('{{user.' ~ pref.name ~ '}}'): pref.value}) %} {% endfor %} {% if comments|length == 0 %} {{ 'error.no_comments_found'|trans }} {% else %} {% for comment in comments %}
{{ widgets.username(comment.createdBy) }}   {{ comment.createdAt|date_full }}   {% if route_pin is not null %} {% elseif comment.pinned %} {% endif %} {% if route_delete is not null and ((not delete_by_user) or (delete_by_user and comment.createdBy.id == app.user.id)) %} {% endif %}
{{ widgets.user_avatar(comment.createdBy, false, 'direct-chat-img img-sm') }}
{{ comment.message|replace(replacer)|md2html }}
{% endfor %} {% endif %} {% endblock %} {% block box_footer -%} {% if form is not null %} {{ form_start(form) }}
{{ form_widget(form.message, {'attr': {'rows': '3', 'placeholder': 'placeholder.type_message'|trans, 'style': 'margin-bottom: 5px'}}) }}
{{ form_widget(form) }} {{ form_end(form) }} {% endif %} {%- endblock %} {% endembed %}