You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
4.0 KiB
Plaintext

5 years ago
{% extends 'layouts/app.twig' %}
{% import 'macros/base.twig' as m %}
{% set only_meetings = only_meetings|default(false) %}
{% block title %}{{ not only_meetings ? __('news.title') : __('news.title.meetings') }}{% endblock %}
5 years ago
{% block content %}
<div class="container">
<h1>
{{ block('title') }}
{%- if has_permission_to('admin_news') and is_overview|default(false) -%}
{{ m.button(m.icon('plus-lg'), url('admin/news', only_meetings ? {'meeting': 1} : {}), 'secondary') }}
5 years ago
{%- 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 %}
<div class="col-md-12 text-center">
<ul class="pagination">
{% for p in range(1, pages) %}
<li{% if p == page %} class="active"{% endif %}>
<a href="{{ url('news', p == 1 ? {} : {'page': p}) }}">{{ p }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}
{% block write_comment %}
{% endblock %}
</div>
</div>
{% endblock %}
{% macro news(news, show_comments_link, is_overview) %}
<div class="card {% if news.is_meeting %}bg-info{% else %}{% if theme.type =='light' %}bg-light{% else %}bg-secondary{% endif %}{% endif %} mb-4">
5 years ago
{% if is_overview|default(false) %}
<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>
5 years ago
</div>
{% endif %}
<div class="card-body {{ m.type_bg_class() }}">
{{ news.text|raw|markdown(false) }}
5 years ago
</div>
<div class="card-footer {% if theme.type =='light' %}bg-light{% else %}bg-secondary{% endif %} text-muted">
5 years ago
{% if news.updated_at != news.created_at and not is_overview %}
<div class="d-flex align-items-center">
<div class="me-3">
{{ m.icon('clock') }} {{ news.created_at.format(__('Y-m-d H:i')) }}
</div>
{{ __('news.updated') }}
</div>
5 years ago
{% endif %}
<div class="d-flex align-items-center">
<div class="me-3">
{{ m.icon('clock') }} {{ news.updated_at.format(__('Y-m-d H:i')) }}
</div>
5 years ago
<div class="me-3">
{{ m.user(news.user) }}
</div>
5 years ago
{% if show_comments_link|default(false) %}
<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') }}
{% endif %}
5 years ago
{% if has_permission_to('admin_news') %}
<div class="ms-auto">
{{ m.button(m.icon('pencil-square'), url('admin/news/' ~ news.id), 'secondary', 'sm') }}
</div>
{% endif %}
</div>
5 years ago
</div>
</div>
{% endmacro %}