{% extends 'layouts/app.twig' %} {% import 'macros/base.twig' as m %} {% import 'macros/form.twig' as f %} {% block title %}{{ news and news.id ? __('news.edit.edit') : __('news.edit.add') }}{% endblock %} {% block content %}

{{ block('title') }}

{% include 'layouts/parts/messages.twig' %} {% if news and news.id %}

{{ m.icon('clock') }} {{ news.updated_at.format(__('Y-m-d H:i')) }} {% if news.updated_at != news.created_at %}  {{ __('news.updated') }}
{{ m.icon('clock') }} {{ news.created_at.format(__('Y-m-d H:i')) }} {% endif %}  {{ m.user(news.user) }}

{% endif %}
{{ csrf() }}
{{ f.input( 'title', __('news.edit.subject'), null, {'required': true, 'value': news ? news.title : ''} ) }}
{{ f.checkbox('is_meeting', __('news.edit.is_meeting'), is_meeting) }} {{ f.checkbox('is_pinned', __('news.edit.is_pinned'), is_pinned) }}
{{ f.textarea('text', __('news.edit.message'), {'required': true, 'rows': 10, 'value': news ? news.text : ''}) }}

{{ m.info(__('news.edit.hint')) }}

{{ f.submit() }} {{ f.submit(m.icon('eye'), {'name': 'preview', 'btn_type': 'info', 'title': __('form.preview')}) }} {% if news and news.id %} {{ f.submit(m.icon('trash'), {'name': 'delete', 'btn_type': 'danger', 'title': __('form.delete')}) }} {% endif %}
{% if news %}

{{ __('form.preview') }}

{% if news.is_meeting %}{{ __('news.is_meeting') }}{% endif %} {{ news.title }}
{{ news.text|raw|markdown(false) }}
{% endif %}
{% endblock %}