Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{% 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), 'csrf_delete': csrf_token(csrf_delete|default('comment.delete')), 'csrf_pin': csrf_token(csrf_pin|default('comment.pin'))} %}
|
||||
{% embed '@theme/embeds/card.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), 'csrf_delete': csrf_token(csrf_delete|default('comment.delete')), 'csrf_pin': csrf_token(csrf_pin|default('comment.pin'))} %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% block box_title %}{{ 'label.comment'|trans }}{% endblock %}
|
||||
{% block box_title %}{{ 'comment'|trans }}{% endblock %}
|
||||
{% block box_attributes %}id="comments_box"{% endblock %}
|
||||
{% block box_body_class %}box-body-scrollable{% endblock %}
|
||||
{% block box_body_class %}box-body-scrollable{% if comments|length > 0%} p-0{% endif %}{% endblock %}
|
||||
{% block box_body %}
|
||||
{% set replacer = {} %}
|
||||
{% for pref in app.user.preferences %}
|
||||
@@ -11,54 +11,48 @@
|
||||
{% if comments|length == 0 %}
|
||||
{{ 'error.no_comments_found'|trans }}
|
||||
{% else %}
|
||||
{% for comment in comments %}
|
||||
<div class="direct-chat-msg">
|
||||
<div class="direct-chat-info clearfix">
|
||||
<span class="direct-chat-name pull-left">
|
||||
{{ widgets.username(comment.createdBy) }}
|
||||
</span>
|
||||
<span class="direct-chat-timestamp pull-left">
|
||||
|
||||
{{ comment.createdAt|date_full }}
|
||||
|
||||
</span>
|
||||
<span class="pull-right">
|
||||
{% if route_pin is not null %}
|
||||
<a href="{{ path(route_pin, {'id': comment.id, 'token': csrf_pin}) }}" class="btn btn-default btn-xs {% if comment.pinned %}active{% endif %}"><i class="{{ 'pin'|icon }}"></i></a>
|
||||
{% elseif comment.pinned %}
|
||||
<i class="{{ 'pin'|icon }}"></i>
|
||||
{% endif %}
|
||||
{% if route_delete is not null and ((not delete_by_user) or (delete_by_user and comment.createdBy.id == app.user.id)) %}
|
||||
<a href="{{ path(route_delete, {'id': comment.id, 'token': csrf_delete}) }}" class="confirmation-link btn btn-default btn-xs" data-question="confirm.delete"><i class="{{ 'delete'|icon }}"></i></a>
|
||||
{% endif %}
|
||||
</span>
|
||||
<div class="divide-y">
|
||||
{% for comment in comments %}
|
||||
<div class="p-3">
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
{{ widgets.user_avatar(comment.createdBy, false) }}
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="text-truncate">
|
||||
<strong>{{ widgets.username(comment.createdBy) }}</strong>
|
||||
</div>
|
||||
<div class="text-muted">{{ comment.createdAt|date_time }}</div>
|
||||
</div>
|
||||
<div class="col-auto align-self-center">
|
||||
{% if route_pin is not null %}
|
||||
<a href="{{ path(route_pin, {'id': comment.id, 'token': csrf_pin}) }}" class="btn{% if not comment.pinned %} btn-ghost-secondary{% else %} btn-ghost-info{% endif%} btn-icon {% if comment.pinned %}active{% endif %} pin-comment-link">{{ icon('pin') }}</a>
|
||||
{% elseif comment.pinned %}
|
||||
{{ icon('pin') }}
|
||||
{% endif %}
|
||||
{% if route_delete is not null and ((not delete_by_user) or (delete_by_user and comment.createdBy.id == app.user.id)) %}
|
||||
<a href="{{ path(route_delete, {'id': comment.id, 'token': csrf_delete}) }}" class="confirmation-link btn btn-ghost-secondary btn-icon delete-comment-link" data-question="confirm.delete">{{ icon('delete') }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{{ widgets.user_avatar(comment.createdBy, false, 'direct-chat-img img-sm') }}
|
||||
<div class="direct-chat-text">
|
||||
<div class="row pt-2 direct-chat-text">
|
||||
{{ comment.message|replace(replacer)|comment2html }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block box_footer -%}
|
||||
{% if form is not null %}
|
||||
{% block box_footer %}
|
||||
{%- if form is not null -%}
|
||||
{{ form_start(form) }}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ form_widget(form.message, {'attr': {'rows': '3', 'placeholder': 'placeholder.type_message'|trans, 'style': 'margin-bottom: 5px'}}) }}
|
||||
<button type="submit" class="btn btn-default">
|
||||
<i class="{{ 'comment'|icon }}"></i>
|
||||
{{ 'label.comment'|trans }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
</div>
|
||||
</div>
|
||||
{{ form_widget(form.message, {'attr': {'rows': '3', 'placeholder': 'placeholder.type_message'|trans, 'style': 'margin-bottom: 5px'}}) }}
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ icon('comment', true) }}
|
||||
{{ 'comment'|trans }}
|
||||
</button>
|
||||
{{ form_widget(form) }}
|
||||
{{ form_end(form) }}
|
||||
{% endif %}
|
||||
{%- endblock %}
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
Reference in New Issue
Block a user