2020-04-05 16:54:45 +02:00
|
|
|
{% extends 'layouts/app.twig' %}
|
|
|
|
{% import 'macros/base.twig' as m %}
|
|
|
|
|
2020-05-12 00:12:49 +02:00
|
|
|
{% set only_meetings = only_meetings|default(false) %}
|
|
|
|
{% block title %}{{ not only_meetings ? __('news.title') : __('news.title.meetings') }}{% endblock %}
|
2020-04-05 16:54:45 +02:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="container">
|
|
|
|
<h1>
|
|
|
|
{{ block('title') }}
|
|
|
|
{%- if has_permission_to('admin_news') and is_overview|default(false) -%}
|
2021-07-17 15:38:20 +02:00
|
|
|
{{ m.button(m.icon('plus-lg'), url('admin/news', only_meetings ? {'meeting': 1} : {}), 'secondary') }}
|
2020-04-05 16:54:45 +02:00
|
|
|
{%- endif %}
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
{% include 'layouts/parts/messages.twig' %}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
{% block news %}
|
|
|
|
{% for news in news %}
|
|
|
|
{{ _self.news(news, true, is_overview) }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% block comments %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block pagination %}
|
|
|
|
{% if pages|default(0) > 1 %}
|
2021-12-26 17:40:13 +01:00
|
|
|
<div class="col-md-12">
|
|
|
|
<ul class="pagination justify-content-center">
|
2020-04-05 16:54:45 +02:00
|
|
|
{% for p in range(1, pages) %}
|
2021-12-26 17:40:13 +01:00
|
|
|
<li class="page-item{% if p == page %} active{% endif %}">
|
2023-08-14 16:02:11 +02:00
|
|
|
<a class="page-link" href="{{ url( only_meetings ? 'meetings' : 'news', p == 1 ? {} : {'page': p}) }}">{{ p }}</a>
|
2020-04-05 16:54:45 +02:00
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block write_comment %}
|
|
|
|
{% endblock %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% macro news(news, show_comments_link, is_overview) %}
|
2023-09-27 18:15:12 +02:00
|
|
|
<div class="card {% if news.is_highlighted %}bg-warning{% elseif news.is_meeting %}bg-info{% elseif theme.type =='light' %}bg-light{% else %}bg-dark{% endif %} mb-4">
|
2020-04-05 16:54:45 +02:00
|
|
|
{% if is_overview|default(false) %}
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="card-header {% if news.is_meeting and theme.type == 'dark' %}text-white{% endif %}">
|
|
|
|
<a href="{{ url('news/' ~ news.id) }}" class="text-inherit">
|
|
|
|
{% if news.is_pinned %}{{ m.icon('pin-angle') }}{% endif %}
|
|
|
|
{% if news.is_meeting %}{{ __('news.is_meeting') }}{% endif %}
|
|
|
|
{{ news.title }}
|
|
|
|
</a>
|
2020-04-05 16:54:45 +02:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2021-08-05 01:00:12 +02:00
|
|
|
<div class="card-body bg-body">
|
2021-12-30 19:18:54 +01:00
|
|
|
{{ news.text(not is_overview)|markdown }}
|
2021-12-10 22:24:18 +01:00
|
|
|
{% if is_overview and news.text != news.text(false) %}
|
2021-12-12 13:13:22 +01:00
|
|
|
{{ m.button(__('news.read_more'), url('news/' ~ news.id), null, 'sm', null, null, 'chevron-double-right') }}
|
2021-12-10 22:24:18 +01:00
|
|
|
{% endif %}
|
2020-04-05 16:54:45 +02:00
|
|
|
</div>
|
|
|
|
|
2023-08-15 21:59:41 +02:00
|
|
|
<div class="card-footer text-nowrap {% if theme.type =='light' %}bg-light{% else %}bg-dark{% endif %} text-muted">
|
|
|
|
<div class="d-flex flex-column flex-md-row align-items-md-center gap-3">
|
|
|
|
{% if news.updated_at != news.created_at and not is_overview %}
|
|
|
|
<div>
|
2023-07-30 17:42:03 +02:00
|
|
|
{{ m.icon('clock') }} {{ news.updated_at.format(__('Y-m-d H:i')) }}
|
2023-08-15 21:59:41 +02:00
|
|
|
{{ __('news.updated') }}
|
2021-07-24 12:38:23 +02:00
|
|
|
</div>
|
2023-08-15 21:59:41 +02:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div>
|
2023-07-30 17:42:03 +02:00
|
|
|
{{ m.icon('clock') }} {{ news.created_at.format(__('Y-m-d H:i')) }}
|
2021-07-24 12:38:23 +02:00
|
|
|
</div>
|
2020-04-05 16:54:45 +02:00
|
|
|
|
2023-08-15 21:59:41 +02:00
|
|
|
<div class="text-truncate">
|
2021-07-24 12:38:23 +02:00
|
|
|
{{ m.user(news.user) }}
|
|
|
|
</div>
|
2020-04-05 16:54:45 +02:00
|
|
|
|
2021-07-24 12:38:23 +02:00
|
|
|
{% if show_comments_link|default(false) %}
|
2023-08-15 21:59:41 +02:00
|
|
|
<div>
|
|
|
|
<a href="{{ url('news/' ~ news.id) }}" class="me-1">
|
|
|
|
{{ m.icon('chat-left-text') }} {{ __('news.comments') }}
|
|
|
|
</a>
|
|
|
|
<span class="badge bg-primary">{{ news.comments.count() }}</span>
|
|
|
|
{{ m.icon('chevron-double-right', 'primary') }}
|
|
|
|
</div>
|
2021-07-24 12:38:23 +02:00
|
|
|
{% endif %}
|
2020-04-05 16:54:45 +02:00
|
|
|
|
2021-07-24 12:38:23 +02:00
|
|
|
{% if has_permission_to('admin_news') %}
|
2023-08-15 21:59:41 +02:00
|
|
|
<div>
|
2022-12-02 23:03:23 +01:00
|
|
|
{{ m.button(m.icon('pencil'), url('admin/news/' ~ news.id), 'secondary', 'sm') }}
|
2021-07-24 12:38:23 +02:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2020-04-05 16:54:45 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|