2020-04-05 16:54:45 +02:00
|
|
|
{% extends 'layouts/app.twig' %}
|
|
|
|
{% import 'macros/base.twig' as m %}
|
|
|
|
{% import 'macros/form.twig' as f %}
|
|
|
|
|
2020-12-06 00:16:15 +01:00
|
|
|
{% block title %}{{ news and news.id ? __('news.edit.edit') : __('news.edit.add') }}{% endblock %}
|
2020-04-05 16:54:45 +02:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<div class="container">
|
2023-10-25 17:38:23 +02:00
|
|
|
<h1>
|
2024-05-21 19:05:33 +02:00
|
|
|
{{ m.button(m.icon('chevron-left'), url('/news'), {'size': 'sm', 'title': __('general.back')}) }}
|
2023-10-25 17:38:23 +02:00
|
|
|
{{ block('title') }}
|
|
|
|
</h1>
|
2020-04-05 16:54:45 +02:00
|
|
|
|
|
|
|
{% include 'layouts/parts/messages.twig' %}
|
|
|
|
|
2020-12-06 00:16:15 +01:00
|
|
|
{% if news and news.id %}
|
2020-04-05 16:54:45 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<p>
|
2023-11-23 14:30:46 +01:00
|
|
|
{{ m.icon('clock') }} {{ news.updated_at.format(__('general.datetime')) }}
|
2020-04-05 16:54:45 +02:00
|
|
|
|
|
|
|
{% if news.updated_at != news.created_at %}
|
|
|
|
 {{ __('news.updated') }}
|
|
|
|
<br>
|
2023-11-23 14:30:46 +01:00
|
|
|
{{ m.icon('clock') }} {{ news.created_at.format(__('general.datetime')) }}
|
2020-04-05 16:54:45 +02:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
 {{ m.user(news.user) }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<form action="" enctype="multipart/form-data" method="post">
|
|
|
|
{{ csrf() }}
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
{{ f.input(
|
|
|
|
'title',
|
|
|
|
__('news.edit.subject'),
|
2023-04-19 22:34:08 +02:00
|
|
|
{
|
|
|
|
'required': true,
|
|
|
|
'value': news ? news.title : '',
|
|
|
|
}
|
2020-04-05 16:54:45 +02:00
|
|
|
) }}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
2023-04-19 22:34:08 +02:00
|
|
|
{{ f.checkbox('is_meeting', __('news.edit.is_meeting'), {
|
|
|
|
'checked': is_meeting,
|
|
|
|
}) }}
|
|
|
|
{{ f.checkbox('is_pinned', __('news.edit.is_pinned'), {
|
|
|
|
'checked': is_pinned,
|
|
|
|
}) }}
|
2024-04-18 14:29:56 +02:00
|
|
|
{% if can('news.highlight') %}
|
2023-09-27 18:15:12 +02:00
|
|
|
{{ f.checkbox('is_highlighted', __('news.edit.is_highlighted'), {
|
|
|
|
'checked': is_highlighted,
|
2023-04-19 22:34:08 +02:00
|
|
|
}) }}
|
|
|
|
{% endif %}
|
2020-04-05 16:54:45 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="row mb-4">
|
2020-04-05 16:54:45 +02:00
|
|
|
<div class="col-md-12">
|
2023-04-19 22:34:08 +02:00
|
|
|
{{ f.textarea('text', __('news.edit.message'), {
|
|
|
|
'required': true,
|
|
|
|
'rows': 10,
|
|
|
|
'value': news ? news.text : '',
|
|
|
|
}) }}
|
2020-04-05 16:54:45 +02:00
|
|
|
|
2021-12-10 22:24:18 +01:00
|
|
|
<p>{{ m.info(__('news.edit.hint')) }}</p>
|
|
|
|
|
2023-11-05 16:29:07 +01:00
|
|
|
{{ f.submit(__('form.save'), {'icon_left': 'save'}) }}
|
2020-04-05 16:54:45 +02:00
|
|
|
|
2021-07-24 12:38:23 +02:00
|
|
|
{{ f.submit(m.icon('eye'), {'name': 'preview', 'btn_type': 'info', 'title': __('form.preview')}) }}
|
2020-10-21 00:12:29 +02:00
|
|
|
|
2020-12-06 00:16:15 +01:00
|
|
|
{% if news and news.id %}
|
2023-11-10 16:20:01 +01:00
|
|
|
{{ f.delete(__('form.delete'), {'confirm_title': __('news.delete.title', [news.title[:40]|e])}) }}
|
2020-04-05 16:54:45 +02:00
|
|
|
{% endif %}
|
2023-12-21 13:41:10 +01:00
|
|
|
|
2024-02-18 11:59:50 +01:00
|
|
|
{{ f.checkbox('send_notification', __('form.send_notification', [notifications_count]), {'checked': send_notification, 'class': 'ms-2 form-check-inline'}) }}
|
2020-04-05 16:54:45 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-10-21 00:12:29 +02:00
|
|
|
{% if news %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2020-12-06 00:16:15 +01:00
|
|
|
<h2>{{ __('form.preview') }}</h2>
|
2020-10-21 00:12:29 +02:00
|
|
|
|
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-secondary{% endif %} mb-4">
|
2021-07-24 12:38:23 +02:00
|
|
|
<div class="card-header {% if news.is_meeting and theme.type == 'dark' %}text-white{% endif %}">
|
|
|
|
{% if news.is_meeting %}{{ __('news.is_meeting') }}{% endif %}
|
|
|
|
{{ news.title }}
|
2020-10-21 00:12:29 +02:00
|
|
|
</div>
|
2021-08-05 01:00:12 +02:00
|
|
|
<div class="card-body bg-body">
|
2021-12-30 19:18:54 +01:00
|
|
|
{{ news.text|markdown }}
|
2020-10-21 00:12:29 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2020-04-05 16:54:45 +02:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|