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

56 lines
2.2 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 %}
{% 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>
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() }}
2021-09-10 14:30:16 +02:00
{{ f.submit(m.icon('trash'), {'name': 'delete', 'btn_type': 'danger', 'size': 'sm', 'title': __('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}) }}
{{ f.submit() }}
</form>
</div>
{% endif %}
{% endblock %}