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

106 lines
4.1 KiB
Twig
Raw Normal View History

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">
<h1>
2024-05-21 19:05:33 +02:00
{{ m.button(m.icon('chevron-left'), url('/news'), {'size': 'sm', 'title': __('general.back')}) }}
{{ 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 %}
&emsp;{{ __('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 %}
&emsp;{{ 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'),
{
'required': true,
'value': news ? news.title : '',
}
2020-04-05 16:54:45 +02:00
) }}
</div>
<div class="col-md-6">
{{ f.checkbox('is_meeting', __('news.edit.is_meeting'), {
'checked': is_meeting,
}) }}
{{ f.checkbox('is_pinned', __('news.edit.is_pinned'), {
'checked': is_pinned,
}) }}
{% if can('news.highlight') %}
{{ f.checkbox('is_highlighted', __('news.edit.is_highlighted'), {
'checked': is_highlighted,
}) }}
{% 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">
{{ 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>
{{ 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 %}
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
<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">
{{ 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 %}