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

62 lines
2.4 KiB
Twig
Raw Permalink 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-12-07 15:11:05 +01:00
{% block title %}{% 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>
2023-12-06 21:15:54 +01:00
<div class="card-footer {{ m.type_bg_class() }} text-muted d-flex align-items-center">
2021-07-24 12:38:23 +02:00
<div class="me-3">
{{ m.icon('clock') }}
2023-11-23 14:30:46 +01:00
{{ comment.created_at.format(__('general.datetime')) }}
2021-07-24 12:38:23 +02:00
</div>
{{ m.user(comment.user, {'pronoun': true}) }}
2021-07-14 01:56:03 +02:00
{% if comment.user.id == user.id or can('admin_news') or can('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 can('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 %}