engelsystem/resources/views/pages/news/news.twig

65 lines
2.5 KiB
Twig
Raw Normal View History

2020-04-05 16:54:45 +02:00
{% extends 'pages/news/overview.twig' %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
2023-11-03 15:02:54 +01:00
{% block title %}
{{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm') }}
{% if news.is_meeting %}{{ __('news.is_meeting') }} {% endif %}{{ news.title }}
{% endblock %}
2020-04-05 16:54:45 +02:00
{% block news %}
{{ _self.news(news) }}
{% endblock %}
{% block comments %}
2021-07-24 12:38:23 +02:00
<div class="col-md-12 mt-4">
2020-04-05 16:54:45 +02:00
<h2>{{ __('news.comments') }}</h2>
{% for comment in news.comments %}
2021-07-24 12:38:23 +02:00
<div class="card {% if theme.type == 'light' %}bg-light{% else %}bg-secondary{% endif %} mb-4">
<div class="card-body {{ m.type_bg_class() }}">
2020-04-05 16:54:45 +02:00
{{ comment.text|nl2br }}
</div>
2021-08-05 01:00:12 +02:00
<div class="card-footer {% if theme.type =='light' %}bg-light{% else %}bg-dark{% endif %} text-muted d-flex align-items-center">
2021-07-24 12:38:23 +02:00
<div class="me-3">
{{ m.icon('clock') }}
{{ comment.created_at.format(__('Y-m-d H:i')) }}
</div>
{{ m.user(comment.user, {'pronoun': true}) }}
2021-07-14 01:56:03 +02:00
{% if comment.user.id == user.id or has_permission_to('admin_news') or has_permission_to('comment.delete') %}
2021-09-10 14:30:16 +02:00
<div class="ms-auto">
2021-07-14 01:56:03 +02:00
<form
action="{{ url('/news/comment/' ~ comment.id) }}" enctype="multipart/form-data"
method="post">
{{ csrf() }}
2023-11-10 16:20:01 +01:00
{{ f.delete(null, {
'size': 'sm',
'confirm_title': __('news.comments.delete.title', [comment.text[:40]|e]),
'confirm_button_text': __('form.delete'),
}) }}
2021-07-14 01:56:03 +02:00
</form>
</div>
{% endif %}
2020-04-05 16:54:45 +02:00
</div>
</div>
{% endfor %}
</div>
{% endblock %}
{% block write_comment %}
{% if has_permission_to('news_comments') %}
2021-07-24 12:38:23 +02:00
<div class="col-md-12 mt-4">
2020-04-05 16:54:45 +02:00
<h3>{{ __('news.comments.new') }}</h3>
<form action="" enctype="multipart/form-data" method="post">
{{ csrf() }}
{{ f.textarea('comment', __('news.comments.message'), {
'required': true,
}) }}
2020-04-05 16:54:45 +02:00
{{ f.submit() }}
</form>
</div>
{% endif %}
{% endblock %}